asp.net core 2.1 preview 2 - signalR CORS issues and 405 on OPTIONS request

若如初见. 提交于 2019-12-23 19:32:18

问题


Using the latest versions of signalR and @aspnet/signalr I still get issues connecting. I'm fairly sure the versions are exactly the same.
I've been following the startup project here. But instead I'm using an Angular 5 application. I get issues with CORS headers and more specifically the OPTIONS request returns a 405 method not allowed.

Visual studio version here.

Typescript/javascript client version here


回答1:


I faced same issue and it appeared that order matters. Make sure you've put it like this:

app.UseCors(...builder...)
app.UseSignalR(...routes...)
app.UseMvc(...routes...)


来源:https://stackoverflow.com/questions/49860919/asp-net-core-2-1-preview-2-signalr-cors-issues-and-405-on-options-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!