Inside my existing application the get request to http://localhost:xxx/signalr/negotiate returns a 500 which I am unable to get more information about to find the actual cause
I have tried creating a brand new MVC project and setting up SignalR - this works.
I have tried using the sample projects and configuring to use my signalr service and these work too.
In both the diagnostic tools and the app insights portal I can't see any more information on what is causing this error 500
Nor does the dev tools in chrome give me more information
Its lengthy, but the best I can track down is a log from IISExpress which has the following error leading my to think its something to do with permissions/access that is being enforced by my application but I'm stuck as for where to start looking.
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>3</Level>
<Opcode>16</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2019-04-11T09:01:02.344Z"/>
<Correlation ActivityID="{80000052-0004-FF00-B63F-84710C7967BB}"/>
<Execution ProcessID="18156" ThreadID="13096"/>
<Computer>DESKTOP-SQ9UCSB</Computer>
</System>
<EventData>
<Data Name="ContextId">{80000052-0004-FF00-B63F-84710C7967BB}</Data>
<Data Name="ModuleName">__DynamicModule_Microsoft.Owin.Host.SystemWeb.OwinHttpModule, Microsoft.Owin.Host.SystemWeb, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35_ed612830-d174-4c74-ba1f-93c69902f2c6</Data>
<Data Name="Notification">4</Data>
<Data Name="HttpStatus">500</Data>
<Data Name="HttpReason">Internal Server Error</Data>
<Data Name="HttpSubStatus">0</Data>
<Data Name="ErrorCode">0</Data>
<Data Name="ConfigExceptionInfo"></Data>
</EventData>
<RenderingInfo Culture="en-GB">
<Opcode>MODULE_SET_RESPONSE_ERROR_STATUS</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
<freb:Description Data="Notification">AUTHORIZE_REQUEST</freb:Description>
<freb:Description Data="ErrorCode">The operation completed successfully.
(0x0)</freb:Description>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{002E91E3-E7AE-44AB-8E07-99230FFA6ADE}</EventGuid>
</ExtendedTracingInfo>
</Event>
Any help would be greatly appreciated!
Thanks, Tom
For reference, this is the code I'm using
The hub is a basic setup with only one function
public void Send(string messageText)
{
Clients.All.broadcastMessage(messageText);
}
In my setup.cs I've followed the basic implementation but I've added some extra debugging (not that its helping!)
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
GlobalHost.HubPipeline.AddModule(new ErrorHandlingPipelineModule());
app.MapAzureSignalR("/AzureSignalr", this.GetType().FullName, new HubConfiguration()
{
EnableDetailedErrors = true,
EnableJSONP = true
});
GlobalHost.HubPipeline.RequireAuthentication();
}
private class ErrorHandlingPipelineModule : HubPipelineModule
{
protected override void OnIncomingError(ExceptionContext exceptionContext, IHubIncomingInvokerContext invokerContext)
{
throw exceptionContext.Error;
}
}
Lastly in my html file again I've followed the basic implementation but I've also tried explicitly setting the url and added more debugging again.
<script src="/Scripts/jquery-3.3.1.js"></script>
<script src="/Scripts/jquery.signalR-2.4.0.js"></script>
<script src="/AzureSignalr/hubs"></script>
<script type="text/javascript">
$(function () {
var messages = $.connection.myHub;
messages.client.broadcastMessage = function (message) {
alert(message);
};
$.connection.hub.url = 'http://localhost:57690/AzureSignalr';
$.connection.hub.connectionSlow(function () {
console.log('We are currently experiencing difficulties with the connection.')
});
$.connection.hub.error(function (error) {
console.log('SignalR error: ' + error)
});
$.connection.hub.start().done();
});
</script>
I've managed to find the solutions to this now, with credit to another question here; Azure SignalR Service Connection is not active
I altered my startup.cs to be the following;
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
app.MapAzureSignalR("/AzureSignalrPath", this.GetType().FullName, new HubConfiguration());
}
}
The important factor was the SecurityProtocol