Running Signalr in IIS on .Net Core - hub being hit but client sees 500 error - iis

I have a .net core application deployed to IIS. There is a signalr hub in the application.
My problem is that when my client hits the hub it receives a 500 error back.
I have put logging in the hub and can see that it is being hit correctly and no exceptions are being thrown.
The setup works perfectly when run from Visual Studio.
I am thinking something might not be set up in IIS correctly.
Does anyone have any ideas that this might be?

I enabled the generic error page in the api and looking at the network tab in the browser I was able to see the call that signalr was making.
I looked at the content of this request and found that an error with the following message was being returned by the server...
The data protection operation was unsuccessful
After some searching I found that this was being caused due to a setting on the IIS application pool.
The steps to change the setting were...
Open IIS Manager
Select Applications Pools, and go ahead and select the App Pool used by your app
Right-click on it, and select Advanced Settings, Go to the Process Model Section and Find the “Load User Profile” Option and set it to True
These steps were taken from http://puresourcecode.com/dotnet/post/ASPNET-The-data-protection-operation-was-unsuccessful

Related

My Server Side Blazor app's Counter isn't incrementing when deployed to Azure

I newed up a server side Blazor project (formerly Razor Components) via dotnet new razorcomponents -o MySampleApp. It works as expected on my machine, when when I right click and attempt to publish to Azure, it fails with a
HTTP Error 503. The service is unavailable.
I solved this by using the "Self-Contained" Deployment Mode, which gets me to the expected Blazor example home page. The weather forecast page works, but the counter page fails to increment. How can I fix this?
I needed to turn on websockets. Duh.
I found it under portal.azure.com > MySampleApp app service > Configuration > General Settings > Web sockets.
Also, apparently I can install the ASP.NET Core 3.0 Runtime in Extensions, which means I can go back to "Framework-Dependent" as a Deployment Mode. This video was a great help: https://www.youtube.com/watch?v=GfazTDXH6JA

Application Insights Reporting Duplicate Events for each Server Request

I have an API App running under Azure App Service, with Application Insights installed to track server side telemetry of API calls. When viewing Application Insights in the Azure portal, I am seeing two events for every one server call. Each event has an exact duplicate with the same timestamp, response time, telemetry, etc. I have verified that only one event is in the web server logs, so I'm not accidentally calling the same function twice from the client.
Here are a couple of screenshots to illustrate:
What could be causing this? And how can I fix it?
There is a one known scenario that may lead to the data duplication:
Application is not onboarded to AI SDK is deployed as an Azure
Web App
AI Extension is installed to the app -> after this step
you start to receive data without need to modify your code
Later on you decided to use more powerful features of AI let's say custom
event tracking and on-boarded your application to AI from VS and
re-deployed.
Now you may end up in the situation when HTTP module is registered twice and you start to receive duplicate request data. It happens because AI nuget packages add HTTP module definition in web.config, but extension installation drops additional assembly into your application bin folder that registers HTTP module dynamically during app start - Microsoft.AI.HttpModule.dll (Microsoft.ApplicationInsights.Extensibility.HttpModule.dll in previous versions). To correctly handle this case you need to remove extension leftovers during your application deployment by choosing "Settings->Remove additional files from destination" in case of deploying from VS.

Azure Emulator appears to hang on Web Role startup

I am trying to use the Azure emulator to debug a .net solution for VS2013, I am using IIS Express and Emulator Express. The project contains several worker roles, which start just fine, and one web roles that seems to hang intermittently. The weird thing is that if I reboot the computer and restart the debugger, it seems to work.
I see the following lines if I click on the "Show Compute Emulator UI" option, Web Role:
[fabric] Role Instance: deployment28(2907).MyApp.Cloud.MyApp.Web.0
[fabric] Role state Unhealthy
When it hangs, I can go to make an initial API call while the dialog is still displaying and see the Unhealthy error message displaying, I receive a response from the API call which would indicate the web role is running even though it is saying the role state is unhealthy and the dialog is still displaying. As a side note, before it returns I see a lot of Loading symbol messages on the lower left of the screen that usually displays a Ready message.
Here is the dialog that is displaying:
1) Why is it hanging if it is able to receive requests?
2) What is a way to troubleshoot a problem like this when you are using the IIS Express and emulator express?
3) What could be the cause of this problem and what are possible solutions?

Application pools won't run

I have two servers sitting behind a loadbalancer in my service tier. Both of them should be identical - IIS setup the same, AppFabric (to keep two services warmed up), app pools running under either a service account or the app pool identity. On one server, everything works. On the other server, three of my app pools (the two that AppFabric is warming up, under the service accounts, and one that's just a standard app pool with no changes made from default settings) stop running almost as soon as I start them up (sometimes on the first request).
I get five of the following error in the Application log each time I try to start one of the app pools:
There was an error during processing of the managed application service auto-start for configuration path: 'MACHINE/WEBROOT/APPHOST/Site/App'. The error message returned is: ''. The worker process will be marked unhealthy and be shutdown. The data field contains the error code.
The error code referenced is 80070005.
This is actually for the same Site/App regardless of the app pool being started (though it may change after recreating the app pools).
In the System log, I get the following warning five times before it errors (Application pool 'AppPool' is being automatically disabled due to a series of failures in the process(es) serving that application pool.):
A process serving application pool 'AppPool' reported a failure during application preloading or service loading. The process id was '2396'. Please ensure that all application preload or service settings in the application pool are configured properly. The data field contains the error number.
The error code referenced is 80004005.
The AppPool here is the one being started.
I've tried recreating; I've tried uninstalling AppFabric (but we need it, so reinstalled and still no go). I'm out of ideas. Any suggestions?
EDIT: I tried copying the applicationHost.config over from the working server, but that didn't work either..
EDIT2: One of the app pools works when running under a real user account but doesn't when running under the ApplicationPoolIdentity....
(Also, we had an issue where the site was running under 2.0 and the apps were running under 4.0. That may have resolved the ones that are running as the service accounts.)
I was just wrestling with this same problem for a few hours and found a different culprit.
I had added a new configuration section to my Web.config in a recent commit. I also added this section to a separate ERB file used by Puppet to generate a custom Web.config at the point of deployment. In this template file, I added the new section but forgot to include its declaration in <configSections>.
Once I added the declaration to the template, our app's test VMs were able to start up again and this error went away.
While the app pools for the applications were 4.0, the app pool for the site itself was 2.0, causing some of the issues. We also had inetpub on a different drive, and we had to grant access to SERVER\Users.

Deploying lightswitch desktop application error

I am having difficulty in deploying my forst lightswitch desktop application.
when i try to publish, in the summary window it says
Database: Donot Publish
and the install.htm file is cofusing to me.
Can someone help me with a step by step tutorial.
I will be grateful.
I have installed Microsoft SQL server 2008.
The process of deploying a LightSwitch-based application differs depending on the application type and deployment scenario that you select. You have said that your lightswitch application is a desktop application. So, the possible deployment scenarios are:
Desktop client 2-tier
Desktop client, 3-tier
These links will help you :
Deploying LightSwitch Applications
How to: Deploy a 2-tier Application
How to: Deploy a 3-tier Application
You should try to get the exception info/stack trace from the server process (vslshost.exe) to get more information about the error when retrieving or saving data. If your app tries to load data when opening, change it so that there is no default screen. This will prevent the app from opening a screen when loading the app and trying to load data, allowing you enough time after opening the app to attach a debugger. You can follow my blog post at http://blogs.msdn.com/b/mthalman/archive/2013/08/16/how-to-get-a-stack-trace-in-lightswitch.aspx for info on how to get the exception info.

Resources