Reputation: 21
I'm using SignalR for communication between my backend server and winform client. Well I tried to start the hub connection between those 2 but I got error from the client. It throw exception 405 Method is not allowed. It said:
{
StatusCode: 405,
ReasonPhrase: 'Method Not Allowed',
Version: 1.1,
Content: System.Net.Http.StreamContent,
Headers: \r\ n {
\
r\ n Date: Tue, 27 Dec 2022 06: 42: 18 GMT\ r\ n Server: Kestrel\ r\ n Content - Length: 0\ r\ n Content - Type: text / plain\ r\ n
}
}
It did some research about this error and tried everything from enable Cors, add useSignalr... which I'm already did. Anyone having the same issue? About the package: I'm using Microsoft.AspNet.SignalR.Core 2.4.3 on Server, Microsoft.AspNet.SignalR.Client 2.4.3 on Client. This is my Service try the hubconnection: My Service with the hub connection 405 Code
I tried to enable Cors, using the same version on server and client for SignalR, use differ packages. I was excepting that it will hit my Hub on my server but no.
Upvotes: 2
Views: 923
Reputation: 1439
I authored the link Jason referenced and I think that link does apply if you are trying to run .NET 4.x (client/server) with .NET CORE 6 (client/server). They don't mix and cannot be used together.
However, from your scenario it looks like you are running - "Microsoft.AspNet.SignalR.Core 2.4.3 on Server" and "Microsoft.AspNet.SignalR.Client 2.4.3"
Which are fine for a .NET 4.7/8 server. 1 issue I see here is "Content: System.Net.Http.StreamContent," will not work because this version does not support streaming (.NET CORE 6/7 does).
Your overall problem may be resolved by checking to see if you can or have .NET 4.7/8 on your server. According to this you should be able to have both but everything will still run in IIS (meaning .NET CORE 6/7 apps must as well in their own app pool).
Hopefully one of these help you resolve your issue.
Upvotes: 1