ASP.NET MVC 5 身份和 Azure

标签 asp.net azure oauth asp.net-mvc-5 asp.net-identity

我正在尝试使用 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>&nbsp;&nbsp;&nbsp;__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>&nbsp;&nbsp;&nbsp;AuthenticateRequest</td></tr> 
<tr class="alt"><th>Handler</th><td>&nbsp;&nbsp;&nbsp;ExtensionlessUrlHandler-Integrated-4.0</td></tr> 
<tr><th>Error Code</th><td>&nbsp;&nbsp;&nbsp;0x00000000</td></tr> 

</table> 
</div> 
<div id="details-right"> 
<table border="0" cellpadding="0" cellspacing="0"> 
<tr class="alt"><th>Requested URL</th><td>&nbsp;&nbsp;&nbsp;http://[site]:80/Token</td></tr> 
<tr><th>Physical Path</th><td>&nbsp;&nbsp;&nbsp;C:\DWASFiles\Sites\[site]\VirtualDirectory0\site\wwwroot\Token</td></tr> 
<tr class="alt"><th>Logon Method</th><td>&nbsp;&nbsp;&nbsp;Not yet determined</td></tr> 
<tr><th>Logon User</th><td>&nbsp;&nbsp;&nbsp;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&amp;IIS70Error=400,0,0x00000000,9200">View more information &raquo;</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/

相关文章:

c# - 从oracle数据库导入验证检查

c# - 如何在多个 Controller 类之间重用 Action Method 验证

asp.net-mvc - ASP.NET MVC Azure Web 角色和临时文件夹大小

rest - 如何在 Magento 中使用 REST API 获取产品信息

python - Twitter 模块 python 'module' 对象没有 Oauth 属性

c# - asp.net core 中所需的 signalR 连接 ID

c# - System.InvalidCastException : 'The SqlParameterCollection only accepts non-null SqlParameter type objects, not SqlParameter objects.'

azure - 使用 SAS 的 Blob 存储的位置

azure - 在azure函数中摄取SSE(服务器发送的事件)?

ruby - 为什么 Mechanize 在看到错误的 OAuth 凭据时会引发 "undefined method ' 任何 ?'"?