答案 0 :(得分:0)
它看起来像CORS问题...在你的webconfig.xml中尝试这个..:
<system.webServer>
<modules>
<remove name="FormsAuthentication" />
</modules>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
然后在你的StartUp.cs文件中:
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Owin;
using Owin;
using Microsoft.Owin.Cors;
[assembly: OwinStartup(typeof(DipendentiStatali.API.Startup))]
namespace DipendentiStatali.API
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseCors(CorsOptions.AllowAll); //<--ALLOW CORS FOR ALL OR FOR WHAT HOST YOU WANT
ConfigureAuth(app);
}
}
}
然后尝试将您的请求发送为JSON
,而不是xx-form-urlencoded