asp.net webapi仅适用于GET

时间:2019-02-25 14:45:48

标签: asp.net asp.net-web-api umbraco

我用asp.net创建了一个webapi,并设置了一些端点。当我在生产服务器上运行它时,它可以工作,但是每当我在实时服务器上运行相同的东西时,我发出的每个请求都会变成GET。 例如,我有

var authenticatedGroups = _configuration.GetSection("AuthenticatedGroups").Get<List<AuthenticatedGroup>>();

services.AddAuthentication(HttpSysDefaults.AuthenticationScheme);
services.PostConfigure<HttpSysOptions>(x => x.Authentication.Schemes = AuthenticationSchemes.NTLM | AuthenticationSchemes.Negotiate)
    .Configure<HttpSysOptions>(x => x.Authentication.AllowAnonymous = false);

services.AddAuthorization(
    x => x.AddPolicy("BicomAuthorization", policy => {
        policy.RequireAssertion(
            u => authenticatedGroups
                .Select(group => u.User.HasClaim("http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid", group.SID))
                .Any(hasClaim => hasClaim == true)
        );
    })
);

 [System.Web.Http.ActionName("University")]
    [System.Web.Http.HttpDelete]
    public HttpResponseMessage DeleteUniversity(string token, int id)
{deletes something}

如果我在邮递员中提出此请求,我将获得GET结果。

[System.Web.Http.ActionName("University")]
    [System.Web.Http.HttpGet]
    public IEnumerable<University> GetUniversity(string token, int id)
{shows some data}

我在做什么错了?

0 个答案:

没有答案