Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

SignalR return 500 error after deployed to server #2216


User avatar
0
trendline created

I am using aspnetzero version 2.2.0, the chat message feature which provided by SignalR, it works fine when debugging in visual studio on local machine. But after deployed the site to server, it returns 500 internal server error via below request URL:http://www.mysite.com/signalr/negotiate?clientProtocol=1.5&connectionData=%5B%7B%22name%22%3A%22abpcommonhub%22%7D%2C%7B%22name%22%3A%22chathub%22%7D%5D&_=1483523711860

I am using visual studio site publish deployed the site, is there something missed to deploy or missed some configurations?


12 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Probably this is the same problems with yours #1891@536442f0-c222-4a71-9068-b8964aa3c0fa. Can you check that ?

    Thanks.

  • User Avatar
    0
    trendline created

    I already checked the post, I am not using Azure, I am using my own server.

    On more question:

    where to implement a custom Cryptography logic in Protect/Unportect methods? which file to modify?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can see the example here <a class="postlink" href="https://github.com/SignalR/SignalR/issues/3670#issuecomment-204041898">https://github.com/SignalR/SignalR/issu ... -204041898</a>. You can create this class in your web project. Then you will need to use it like this.

    app.SetDataProtectionProvider(new YourCustomProtectionProvider());
    

    By the way, do you have any error message in your Logs.txt file ?

  • User Avatar
    0
    trendline created

    Yes, some error in logs, this maybe related with SignalR

    RROR 2017-01-07 00:19:53,567 [302 ] e.Diagnostics.ExceptionHandlerMiddleware - An unhandled exception has occurred: The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating. System.Security.Cryptography.CryptographicException: The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating. at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope) at System.Security.Cryptography.DpapiDataProtector.ProviderProtect(Byte[] userData) at Microsoft.AspNet.SignalR.Infrastructure.DataProtectionProviderProtectedData.Protect(String data, String purpose) at Microsoft.AspNet.SignalR.PersistentConnection.ProcessNegotiationRequest(HostContext context) at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(HostContext context) at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Owin.WebSocketAcceptAdapter.<>c__DisplayClass6_0.<<AdaptWebSockets>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>d__6.MoveNext()

  • User Avatar
    0
    trendline created

    And, I am using asp.net core Zero, it seems in the StartUp.cs no extensions like app.SetDataProtectionProvider(), like below:

            app.UseAbp();
    
            app.MapSignalR();
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Do you have access to IIS on your hosting ? If so, in your application pool's advanced settings you can set Load User Profile to true and that might solve this problem.

  • User Avatar
    0
    trendline created

    Great! After set load user profile to true resolved the issue. Thanks a lot.

  • User Avatar
    0
    goldstone created

    I have same problem. I am using aspnetZero v4.3.0.0 Asp.net Core targeting .net framework 4.6.1 + jquery. My test environment is Windows Server 2012 R2, IIS 8. I have made configurations as in "https://docs.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x". I have also installed Websocket role for win server 2012. I googled so much but couldn't get any result. I also applied "https://github.com/aspnetzero/aspnet-zero-core/commit/8d88cdd6a27a03e9eb784bb7425ee38f58d1ba11" but no result.

    I am getting "negotiate?clientProtocol=1.5&connectionData=%5B%7B%22name%22%3A%22abpcommonhub%22%7D%2C%7B%22name%22%3A%22chathub%22%7D%5D&_=1507899535628" 500 Internal Server Error.

    Am I missing server configuration?

    Looking forward for your reply!

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @goldstone,

    Do you have any error message in Logs.txt under your web project ? There are different reasons of signalr problem.

  • User Avatar
    0
    GeovaniMartinez created

    I got the SignalR error mentioned when I did a clean install. After I created a tenant and a user the error went away. Sounds to me that and empty result (user list) may have been the root cause. Figure I share that observation with you all.

  • User Avatar
    0
    alirizaadiyahsi created

    Hi @GeovaniMartinez,

    Thanks for report, we will check this. Also I created an issue for this: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/542">https://github.com/aspnetzero/aspnet-ze ... issues/542</a>

  • User Avatar
    0
    feryat.olcay created

    Hi,

    Prerequisites What is your product version? 11.3.0

    What is your product type (Angular or MVC)? Angular

    What is product framework type (.net framework or .net core)? .NET Core

    We got the same error. In our scenario, we want to connect to the API with SignalR from a console application. We do not get any problems on local with Angular app and console app. When we deploy the API to IIS, we get the following error after run the Console App. Do you have a suggestion?

    "AspNetCore.Server.IIS.Core.IISHttpServer - Connection ID "17582052955455006947", Request ID "8000a8e4-0002-f400-b63f-84710c7967bb": An unhandled exception was thrown by the application. System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters."

    Thank you for your support.