Windows身份验证返回代码401但页面加载

时间:2017-12-22 10:13:42

标签: c# asp.net-mvc windows-authentication

我在启用Windows身份验证的情况下创建了新的ASP.NET MVC项目。当我正在调试我的应用程序时,我正在获取像这样的Application Insights事件:

{
  "name": "Microsoft.ApplicationInsights.Dev.Request",
  "time": "2017-12-22T09:28:35.4630536Z",
  "tags": {
    "ai.internal.sdkVersion": "web:2.4.1-1362",
    "ai.internal.nodeName": "mydomainname.domain",
    "ai.operation.id": "C4OK4mTY6jE=",
    "ai.location.ip": "::1",
    "ai.cloud.roleInstance": "mydomainname.domain",
    "ai.operation.name": "GET /Reports"
  },
  "data": {
    "baseType": "RequestData",
    "baseData": {
      "ver": 2,
      "id": "|C4OK4mTY6jE=.5781c7f2_",
      "name": "GET /Reports",
      "duration": "00:00:00.0002075",
      "success": true,
      "responseCode": "401",
      "url": "http://localhost:56785/Reports",
      "properties": {
        "DeveloperMode": "true"
      }
    }
  }
}

浏览器中的响应标头是:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/10.0
X-AspNetMvc-Version: 5.2
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcYWd1dG93c2tpXERvY3VtZW50c1xWaXN1YWwgU3R1ZGlvIDIwMTdcUHJvamVjdHNcUmVwb3J0c01vbml0b3JcUmVwb3J0c01vbml0b3JcUmVwb3J0cw==?=
Persistent-Auth: true
X-Powered-By: ASP.NET
WWW-Authenticate: Negotiate oRswGaADCgEAoxIEEAEAAAA14Wb6RKuvgwAAAAA=
Date: Fri, 22 Dec 2017 09:28:35 GMT
Content-Length: 3446

页面加载正确,但速度很慢。这是我的Web.config:

<authorization>
  <allow roles="mydomainname\Admin, mydomainname\User" />
  <deny users="*" />
</authorization>
<authentication mode="Windows" />

我有另一个具有相同配置的应用程序,一切正常。 我错过了什么?

0 个答案:

没有答案