我正在尝试使用 MVC 5 spa 模板
将测试网站从新的 Visual Studio 2013 RC
发布到 azure。
我可以让注册/登录/注销过程正常工作,只是有一个小问题困扰着我。如果我尝试使用错误的凭据登录,返回到页面的错误字符串是“发生未知错误”。而不是“用户名或密码不正确”。如果 ApplicationOAuthProvider.cs
中的 GrantResourceOwnerCredentials
正常工作,就应该如此。
在本地主机上,我得到正确的“用户名或密码不正确”。消息。
来自 Azure 的错误日志:
</head>
<body>
<div id="content">
<div class="content-container">
<h3>HTTP Error 400.0 - Bad Request</h3>
<h4>Bad Request</h4>
</div>
<div class="content-container">
<fieldset><h4>Most likely causes:</h4>
<ul> <li></li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><h4>Things you can try:</h4>
<ul> <li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><h4>Detailed Error Information:</h4>
<div id="details-left">
<table border="0" cellpadding="0" cellspacing="0">
<tr class="alt"><th>Module</th><td> __DynamicModule_Microsoft.Owin.Host.SystemWeb.OwinHttpModule, Microsoft.Owin.Host.SystemWeb, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35_08fdea3d-9972-4dc2-b0fc-c8ffdb2e4253</td></tr>
<tr><th>Notification</th><td> AuthenticateRequest</td></tr>
<tr class="alt"><th>Handler</th><td> ExtensionlessUrlHandler-Integrated-4.0</td></tr>
<tr><th>Error Code</th><td> 0x00000000</td></tr>
</table>
</div>
<div id="details-right">
<table border="0" cellpadding="0" cellspacing="0">
<tr class="alt"><th>Requested URL</th><td> http://[site]:80/Token</td></tr>
<tr><th>Physical Path</th><td> C:\DWASFiles\Sites\[site]\VirtualDirectory0\site\wwwroot\Token</td></tr>
<tr class="alt"><th>Logon Method</th><td> Not yet determined</td></tr>
<tr><th>Logon User</th><td> Not yet determined</td></tr>
</table>
<div class="clear"></div>
</div>
</fieldset>
</div>
<div class="content-container">
<fieldset><h4>More Information:</h4>
The request could not be understood by the server due to malformed syntax.
<p><a href="http://go.microsoft.com/fwlink/?LinkID=62293&IIS70Error=400,0,0x00000000,9200">View more information »</a></p>
<p>Microsoft Knowledge Base Articles:</p>
我不确定它怎么可能是格式错误的语法,因为在提交正确的登录凭据时会发送和处理相同的语法。
是否有人对此足够熟悉,知道发生了什么,或者至少有一条路径可以接近知识库文章之外的答案?如果还不是很明显,那么我对此很陌生 - 这是我在 ASP.NET 中的第一个网站,第一次介绍 OAuth,也是第一次使用 Azure。
最佳答案
由于此内容已被查看几次,我只想添加更新/答案。我从未找出问题所在,但更新到 Visual Studio 2013 RTM 后问题就消失了。 RTM 中的 ASP.Identity 有相当多的更新,所以我不确定是什么修复了它(它甚至可能与 VS 无关,据我所知,通过应用于 Azure 的更新修复了它),但希望如此任何遇到同样问题的人也都看到它消失了。
关于ASP.NET MVC 5 身份和 Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19079533/