2013-09-29 45 views
2

我正嘗試使用MVC 5 spa template將新測試網站從Visual Studio 2013 RC發佈到azure。ASP.NET MVC 5身份和Azure

我可以得到註冊/登錄/註銷過程工作得很好,除了有一個小問題困擾着我。如果我嘗試使用錯誤的憑據登錄,返回頁面的錯誤字符串是「發生未知錯誤。」而不是「用戶名或密碼不正確。」因爲它應該如果GrantResourceOwnerCredentialsApplicationOAuthProvider.cs工作正常。

在本地主機上,我找回正確的「用戶名或密碼不正確。」信息。

錯誤日誌從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的第一次使用。

+0

我一直在看fiddler中的POST標題和請求正文,我看不到有良好憑據的登錄語法和具有錯誤憑據的語法之間的區別。有其他人有這個問題嗎?也許這是一個與這是新的mvc 5身份系統相關的錯誤?也許說明問題的azure日誌格式錯誤。 – user2787092

+0

看來,這不是一個Azure問題,而是ASP.NET MVC。也許在你的代碼中,你會顯示用戶的名字,但是你沒有檢查身份是否與空值不同。一個好的提示:啓用Nugget Elmah並重復此測試。你將能夠看到錯誤和堆棧跟蹤。 –

+0

我應該提到代碼在localhost上工作。它只返回Azure上的「發生未知錯誤」,我只是更新了原文,以表明這一點,但我會考慮Elmah,謝謝你的建議。 – user2787092

回答

0

由於這已被查看了幾次,我只是想添加更新/答案。我從來沒有發現問題所在,但是在更新到Visual Studio 2013 RTM後,它就消失了。有很多更新ASP.Identity在RTM中,所以我不確定是什麼修復了它(它甚至可能與VS無關,並且已經通過適用於我所知的Azure更新進行了修復),但希望任何有這個問題的人也會看到它消失。