Application Insights extension breaking Azure web app - asp.net

I had Application Insights running smoothly on an Azure Web App via the AI SDK, reporting to an AI instance hosted in Azure.
The only niggle was it didn't show detailed dependancy diagnostics, according to this page this was because I was using the SDK only, I needed to "Instrument your web app on the server", which looking at the docs can't be done if you already have an instance of AI running....helpful!
Reluctantly I deleted the AI instance, stripped the SDK from my code so I was starting fresh, and followed the steps, however as soon as I finished the process in the previous link my website broke and now responds to every single request (MVC5 and Web API) with an empty 404 request
The AI status page is showing green ticks for everything, and I can't discern anything from diagnostic log dump from KUDO or manage to remotely debug the site.
Deleting the AI extension under Web App -> Extensions in the Azure portal and then restarting the web app fixes the problem.
I've run out of ideas on how to fix this, is there anything else I can do to get to the bottom of the problem?

To fix this problem, delete the following 2 files from your web app's (or slot's) filesystem:
D:\home\siteextensions\Microsoft.ApplicationInsights.AzureWebSites\Instrumentation32\ProductionBreakpoints_x86.config
D:\home\siteextensions\Microsoft.ApplicationInsights.AzureWebSites\Instrumentation64\ProductionBreakpoints_x64.config
You can do this easily through Kudu.
Edit: Apparently this is/was an issue with the ProductionBreakpoints interacting with precompiled views. Microsoft has informed me a fix should be out within the next couple days. The version of Application Insights extension I have now that is still broken is 2.4.6 - I will post the "fixed" version when I can confirm it.
Edit 2: Confirmed this is fixed in 2.4.7 which is out now.

Related

"Adding sign-in with Microsoft" example does not work on my working VDI

Good day everyone!
Background: I have old legacy ASP.NET MVC on premise application running on local windows IIS. I'm investigating ways to integrate this application with Azure AD authentication. As far as I can understand (Windows IIS integration with Azure AD) it's not possible to do it directly because of the Azure AD authentication can be added at the application level only. So I'm thinking integrating one of the MSAL library for adding Azure AD authentication.
Using this windows manual (Quickstart: Add sign-in with Microsoft to a web app), I've downloaded sample windows application (ASP.NET code sample) from this learn page and tried to run it within the Visual Studio 2022 in debug mode on my azure virtual work machine (based on VDI platform).
And Azure AD authentication does not work. When I click "Sign in with windows" button on the start application page, I get the error:
Server Error in '/' Application.The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.
Requested URL: /login.aspx
This sample works fine on my local laptop in exactly the same state. I suggest that any security utilities might be the reason, but I don't know how to check it. I can't disable security apps on my working machine, and maybe there are any restrictions on the network level I don't even know nothing about.
Could somebody suggest any ways to solve this problem? Or maybe still ways to find the reason of this problem?
Thank you in advanced!

Azure AppService IIS does not have correct path to App

Trying to migrate a legacy ASP.NET WebForms/MVC hybrid application from Cloud Services to App Services. All runs fine locally in debug Visual Studio (V2022). The app is predominantly webforms but MVC has been retro fitted and is in use for some pages. It's using .NET Framework 4.8.
Deploying directly from Visual Studio. We have created a new App Service and App Service Plan. The site appears to deploy correctly but the endpoint returns the below as raw text, i.e. the web browser doesn't even attempt to render it, presumably as there is no header information specifying html content-type:
Have checked the configuration for the app service, all appears normal (same as other app services that run quite normally). It's set to ASP.NET 4.8 with all the other standard defaults. The default documents includes Default.aspx which matches the application. The application is using Forms authentication and defaults to a Login.aspx page. We have tried removing this and redeploying but we still get the same result. Configuration and Management diagnostics section on the Azure portal shows no significant errors.
In Kudu (advanced settings) if I access the debug console, I find my app is deployed to c:\home\site\wwwroot> as expected, however if I click "Site Root" it flips me to c:\local>
Could it be IIS is pointing to the wrong path for the site?
In the end found some rogue code that was causing the issue. The different paths under Kudo was a red herring.
To diagnose the problem we moved from VS deployment to CI deployment and still had same issue. This meant it was not publishing settings. We compared web config with other solutions that ran fine as app services and found no significant differences. This ruled out IIS settings from web.server section. We checked for errors on the app and found no errors being reported.
In the end we trawled through the code and eventually found something that was URL specific.

Azure Website Deploys but displays 500 error

I've published an app to Azure for the first time. When I go to the site I get an HTTP 500 error saying
The page isn't working. *****.azurewebsites.net is currently unable to handle this request.
Looking at the Live Metrics Stream on the Azure Portal it says
Not available: your app is offline or using an older SDK
This is a .Net Core app.
When I published it there were no errors. It said the build and publishing were successful. I'm not sure what other information I can give to help someone help me resolve this. I'm including some screenshots that may have some helpful information. I've been stuck for a whole day now.
Below is an error from the Azure Portal:
Here is my web.config file:
Here are the general settings from Azure:
Here are some errors from Azure:
Here is the Publish page from Visual Studio (disregard the arrow):
I figured it out.
Earlier I had briefly experimented with using the .net Google Oauth library in my project. I eventually incorporated Oauth by hand and never removed the code for Google Oauth in Startup.cs. This didn't cause a problem locally but, the streaming logs showed an error saying the "ClientID option must be provided". ClientID is related to the Oauth library.
Viewing the Streaming Logs in Visual Studio is what helped me solve this. Maybe this will help someone in the future.

Web Deploy - two similar apps 1 works 1 doesn't despite successful deploy reported

I've got a Windows 2012 r2 server with IIS 8.5 running on it.
I am trying to deploy a new web app in a sub folder of the root website. This is my third web app that I will have up there and the prior two are fine, but for some reason this app when I use Web Deploy to push it doesn't fully populate all of the Features for the app.
I had to manually enter Application Settings and Session State is completely greyed out so I can't even fill in what exists on the other web apps I've published.
Recently I upgraded to VS 2017 so I thought it might be a glitch in my setup so I ripped one of the two existing apps out and did a re-deploy on them and they work perfectly.
I'd post more info but I am not sure what someone helping might want to see.
Any ideas on what's going on?
Updated: May Monday 15th,7:50AM Central US --
I went back and looked at the Features view and compared the content from the working app (republished as a test and still worked fine) and this one that I'm having the difficulty with. Here are the results. (this with 100% success reported in Web Deployment publish)
I am able to edit the first two of these feature items to make them identical to the working app but not the third. All options on this are grayed out:

azure deploy issue:do not have permission to view this directory or page

I tried to deploy my asp.net mvc web application to azure. But somehow, I could not using web deploy in vs2015 community, I always receive an error:
Web Deploy experienced a connection problem with the server and had to terminate the connection. Contact your server administrator if the problem persists. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CONNECTION_TERMINATED. WebApplication6 0.
So I changed to deploy using local git to deploy to azure. I was able to deploy, but when I typed in the url of the web app, I got:You do not have permission to view this directory or page. And I can't access any of the controller I defined in the code. Could any one help me out?
there are a few thing you can do to trouble shoot
first find out if your site is deployed.
go to https://{site name}.scm.azurewebsites.net/DebugConsole, navigate to "D:\home\site\wwwroot", make sure you see the right content is there.
check if your app deployed properly. If your site is asp.net site, when you do local git push (push your source code), you should see Azure will try to build your code. Check if deployment success. From debug console, go to https://{your site name}.scm.azurewebsites.net/api/deployments or from portal you should be able to see your deployment log
if none of the above help you to find out what is wrong, please report your site name here with this instruction https://github.com/projectkudu/kudu/wiki/Reporting-your-site-name-without-posting-it-publicly
I can help and look into your site.
Get the answer from git hub issues' reply, azure web app doesn't support asp.net 5 anymore.
I was facing same issue.
Verify following thing-
Go to deployed web app on azure portal and then go to App service editor and check required folder structure is available under WWWROOT folder and not WWWROOT->Webapp->bin etc.

Resources