question

OrenA-7958 avatar image
0 Votes"
OrenA-7958 asked ZhiLv-MSFT edited

Signalr gives 405 Method Not Allowed

Trying to deploy my website to Azure, Signalr gives the following errors on the browser:

Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
For this call:

hubs/presence/negotiate?negotiateVersion=1:1
Followed by:

Error: Failed to complete negotiation with the server: Error: The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.: Status code '405'
Here are the endpoints:

 app
                 .UseEndpoints(endpoints =>
                 {
                     endpoints.MapControllers();
                     endpoints.MapHub<PresenceHub>("hubs/presence");
                 });

The website works on https, and the urls are defined as follows:

 export const environment = {
   production: true,
   apiUrl:'https://vidcallme.azurewebsites.net/api/',
   hubUrl:'https://vidcallme.com/hubs/',
   baseUrl:'/'
 };

The api works, the hub doesn't.

Here's the Api web.config

 <system.webServer>
       <handlers>
         <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
       </handlers>
       <aspNetCore processPath="dotnet" arguments=".\API.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
     </system.webServer>

The client is written with Angular

Related: SignalR Error 405 (method not allowed) - Negotiate.

I'm Using .net Core 5.0



azure-webappsdotnet-aspnet-core-generalazure-signalr-service
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Did you enable CORS in the SignalR/Web API application?

See the SignalR troubleshooting docs.

In my opinion, it's a little odd to implement SignalR and Web API. Usually, you pick one or the other. Are you sure the error is from SignalR and not Web API?


0 Votes 0 ·

I have enabled CORS.
The negotiate web method belongs to signalr, and is invoked for a signalr hub.

I'm familiar with the troubleshooting docs, it states clearly it's a CORS issue, which isn't the case here

0 Votes 0 ·

0 Answers