An error occured while processing your request - azure-web-app-service

I've just taken this tutorial about how to create a .NET Core with SQL DB.I get the following error message the webapp created as part of this process. I would appreciate some pointers as to what can be done to fix the problem indicated in error. Thanks
Error.
An error occurred while processing your request. Development Mode
Swapping to Development environment will display more detailed
information about the error that occurred. Development environment
should not be enabled in deployed applications, as it can result in
sensitive information from exceptions being displayed to end users.
For local debugging, development environment can be enabled by setting
the ASPNETCORE_ENVIRONMENT environment variable to Development, and
restarting the application.

You could try to set the environment variable inside the web app on azure.
Open the Application Settings blade and go down to the "Application Settings" section to add the "ASPNETCORE_ENVIRONMENT" and "Development".
Refer to this article which provides an overview of the tasks that are required to publish a visual studio web project to a server where others can access the application over the Internet.
Also, you could use azure SQL Database to connect to web app on azure.

Related

Using Application Insights with On-Premise IIS Server

I am trying to debug a dotnet core 5 Blazor Server app which is eating up all the memory of the IIS Server when it is deployed to a local IIS Server.
However, it is not clear what is causing the memory leak.
As far as I have been able to figure out, installing Application Insights should create the logs needed to be able to determine what the issue is.
So I have added App Insights to the Project. When I run the project, I can then see App Insights Events being created in Visual Studio.
However, the issue occurs when the app is published to the Production IIS Server. I don't understand how to view the application insight data from the Prod Server. Are logs being generated?
I have tried to find data on this, but most of what I found is for Azure Application Insights. But the app is not running on Azure.
So how do I view the logs from the Prod Server? Or is there a better way to debug this issue?
So I have added App Insights to the Project. When I run the project, I can then see App Insights Events being created in Visual Studio.
However, the issue occurs when the app is published to the Production IIS Server. I don't understand how to view the application insight data from the Prod Server. Are logs being generated?
Let me get this clear: you have created an Azure Application Insights resource. When your run the project using the debugger you can see telemetry being generated.
Is this correct?
How did you verify telemetry is being generated?
If it works locally it should work when deployed on IIS. Your application will generate telemetry that will be send to the Application Insights resource in de Azure Cloud. It does not matter whether you app is actually hosted on Azure or not in this scenario.
If you are not seeing telemetry make sure the instrumention key is correctly set in the production environment.
There are several ways to explore the telemetry send to Application Insights:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/diagnostic-search
https://learn.microsoft.com/en-us/azure/azure-monitor/app/overview-dashboard
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/queries
After some study, I found the answer to this.
You can use Azure Application Insights to view data collected from an asp.net core app, no matter where the app is actually running. It can be running on-premise, or in the cloud.
The way this works is that in your app, you add a "Connection String" for application insights. The connection string is made available in the Application Insights resource that you create in Azure.
Then you add this connection string to your code in your app. The, when the app runs, whether in Visual Studio, or from a published location, the app send data up to the Azure Resource through an endpoint.
The connection string looks like this:
InstrumentationKey=000000-0000-0000-0000-000000000;IngestionEndpoint=https://eastus2-0.in.applicationinsights.azure.com/
Then you add code such as:
var options = new ApplicationInsightsServiceOptions { ConnectionString = #"InstrumentationKey==000000-0000-0000-0000-000000000;IngestionEndpoint=https://eastus2-0.in.applicationinsights.azure.com/" };
services.AddApplicationInsightsTelemetry(options: options);
There are a number of ways to actually add the connection string. See the docs here
You then log into Azure to view the data collected.

No data for my application insights live metrics with .NET Core 3.1

I'm trying to setup Application Insights on my ASP.NET Core 3.1 web application but without success...
I installed the version 2.16 of "Microsoft.ApplicationInsights.AspNetCore", then add the following line in the startup.cs file:
services.AddApplicationInsightsTelemetry(_configuration);
Moreover, I added the following section in the appSettings:
"ApplicationInsights": {
"InstrumentationKey": "XXX"
}
When I launch this with Visual Studio, I can see data in Live metrics, however, as soon as I deploy this in the production server with IIS, it just display that the application is off. I tried to put the connection string instead, without luck.
I'm suspecting a proxy issue, however, I have no way to be sure of this and it seems unlikely because I'm using the proxy as well on my local machine where it works.
I put the log level of the application on "Information" and I see nothing related to Application Inisights. I even tried to enable the developer mode, it didn't change anything.
The main issue is that I have no error anywhere, so I don't even know what to search :-)
I have encountered the same situation as you, but I'm not sure if we are facing the same error because of no error message.
I have my own ASP.NET Core 3.1 web application and I did the same configuration in my project, and when run it by vs in local environment, azure application insights can show live metrics, when have deployed in azure app service, it shows 'your app is offline'.
In my scenario, it's result from web app instance creation. When I creating an app service, it will create new application insights as default. Like the screenshot below, and of course the new one has different instrumentation key from the key in 'appSetting.json', it caused that when I look into application sights configured in the project, I can't see live metrics but I can see in the application sights that has the same name with app service.
And when creating app service with new application insights, the configuration tab in web app will display some keys like below, and they won't exist if didn't create new insights.
Upon this situation, I tried to modify these two keys with the value of insights that is used in project, and then live metrics worked.
Priority for obtaining the insights configuration may lead to my problem, because there are several ways to set connection.

Azure SQL Database Error, but works in localhost debug mode

I have a question regarding asp.NET Core and Azure SQL Database
We can successfully connect to Azure SQL DB via the localhost or VS Debug. I used the same Publish connection string to update the appsettings.json "DefaultConnection". We continue to get an error on Azure URL when trying to login or register. It is not able to connect to the same Azure SQL database successfully.
Also, we get the standard error, which is set correctly in the config files.
Error. An error occurred while processing your request. Development Mode Swapping to Development environment will display more detailed information about the error that occurred. Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.
Not sure what the issue is with Azure connecting to the database...any help appreciated. To recap, it works with the Azure SQL DB from local host, and the DefaultConnection is the same for both versions.
If I recall correctly, the Azure Web Apps do a bit of work under the covers to make it possible to change the connection string from the portal; as a result, it may complicate the process you attempted to use with "publish", as it may not update the key-value pairs that it stores the connection string as. AFAIK, updating/publishing again will update the code, but not the existing values that are in the key-value store.
This is detailed here: how connection strings work in Azure Web Apps

How to resolve error 500 on Azure web app?

What I have:
VS2015U2
ASP.NET 5 MVC 6 website
Deployed to Azure Web App
The site works locally
When I deploy to Azure I get internal server error (500)
I'm unable to Attach a debugger since they messed up something with the latest versions (tried manually too https://azure.microsoft.com/en-us/blog/introduction-to-remote-debugging-on-azure-web-sites/)
I have app.UseDeveloperExceptionPage(); but I guess the site is failing during configuration so it doesn't display any other information.
So how to resolve this? I need to see the .net exception but I have no idea how to do that.
Try adding Application Insights to the app. You should see errors on startup of your application.
I would also take a look at your startup code to see if you are writing to disk anywhere during configuration or app.start. This might be the case if you are using AAD in any capacity.
You can also hit up the KUDU console by targetting https://sitename.scm.azurewebsites.net . You will be able to navigate in the debugging console to see the RAW logs from IIS. That might shed some light into the situation. See KUDU for more info.
I solved this problem like show below.HTTP 500 error interested about that is not allowed to access the server.Go to azure portal address and choose your database.Press"Set server firewall " and Allow Azure services and resources to access this server choose "Yes" save that page and refresh your service.Than you can see your data
Use the KUDU console at https://sitename.scm.azurewebsites.net
Go to web.config file and check if the process path is correct.
I used the Azure Log Stream to help figure out what was going on. As Karishma Tiwari - MSFT said, the issue ended up being my web.config file (which was built for .NET 3.5 and not 4.7)
Here's the tutorial to set up Log Streaming: https://blogs.msdn.microsoft.com/azureossds/2016/09/28/how-to-identifyreview-errors-on-php-applications-in-azure-web-apps-using-log-stream-service/
My particular app's solution was to update my Azure App Service to use .NET 3.5, in its Application Settings, like so:
For me it worked after I turned "Allow Azure services and resources to access this server
" to Yes
I got this error even though I had enabled Application Logging (Filesystem), Detailed error messages and Failed request tracing in App Service logs
This page isn’t working
mysite.azurewebsites.net is currently unable
to handle this request.
HTTP ERROR 500
However by navigating to Log stream and selecting Application Logs I could see a detailed error message:
I know this question has already been answered but here is a recent view of the Azure Portal where I found a solution to this problem

How to use IntelliTrace in Azure Development Fabric?

When I create a new Azure solution (with a web role and a worker role), add a line of code to the Default.aspx.cs file, put a breakpoint there, and launch debugging in the Development Fabric, when the breakpoint is hit and I look at the Intellitrace tab, I am confronted with the following error message:
Intellitrace is not collecting data for this debugging session. The project type may not be supported or the process you are debugging may have been either attached to or launched with IntelliTrace disabled. Restarting the debugging session within Visual Studio may solve this. Please note that IntelliTrace is not supported when attaching to a process that is already running. If you have selected a custom location for InteliTrace [sic] recordings, please make sure it is writable by the process being debugged.
The problem also occurs with other Azure solutions that I previously created. When I create a standard ASP .Net web application, I am able to use IntelliTrace without difficulty. I have tried this both without selecting a custom location for IntelliTrace recordings and using the same location that I used for a standard ASP .Net web application. I tried restarting the computer too. I also reinstalled the Windows Azure SDK. Because of concern that IntelliTrace might not work when SQL Server Debugging is enabled, I made sure that SQL Server Debugging was disabled on the worker role (the only project that had an option for this in the Debug tag of the project settings).
The closest resource on this question is on the MSDN forums. The answer is unclear. It states, "For locally, you can enable IntelliTrace, but you would have to add the add-in by hand." What add in, and what does it mean to add the add-in by hand? The answer there also refers to this blog post, but that discusses only how to enable IntelliTrace for applications that have already been deployed to the Windows Azure cloud and does not address using IntelliTrace in the Development Fabric.
Intellitrace doesn't work against the local dev fabric. You have to deploy your application to get Intellitrace to work. More about debugging Azure apps here.

Resources