问题
I am finding we receive this error:
Failed to invoke 'CreateChatRequest' due to an error on the server. HubException: Method does not exist.
at _this.callbacks.<computed> (chat.min.js:2060)
at HubConnection.processIncomingData (chat.min.js:2154)
at WebSocketTransport.HubConnection.connection.onreceive (chat.min.js:1881)
at WebSocket.webSocket.onmessage (chat.min.js:3922)
The method does exist. The code does work, then after a while of testing, it returns this and won't stop.
What seems to temporarily fix the issue is restarting the Azure SigR service, but it comes back. This issue does not occur when targeting local SigR during development; it only happens against Azure SigR.
According to documentation, this seems to be a catchall error when something errors up on the server but, no exceptions are being logged. I've turned on detailed errors, but that didn't change the error coming back from the server. I've also tried catching the exception and sending back a HubException to see what is going on, but that didn't change the error message either.
TIA for any help.
回答1:
So the answer, for me, was that i'd checked in (to source control) my azure service's connection string, so other devs were also using this and pointing their versions of the API service at that azure service. So when i ran my code sometimes azure would hit my API service with the new method in and it would work, sometimes it would hit someone else's API service and so fail because their code didn't have the new method in.
来源:https://stackoverflow.com/questions/56023085/azure-signalr-hubexception-method-does-not-exist