5

這VS 2012擴展的目的是讓我到本地開發STS添加到我的MVC應用程序http://visualstudiogallery.msdn.microsoft.com/e21bf653-dfe1-4d81-b3d3-795cb104066eMS身份和訪問工具MVC 4

我按照非常簡單的指令如右鍵單擊項目名稱,然後在菜單中選擇「身份和訪問」。選擇您的身份提供商並點擊確定將設置應用於您的web.config。

我跑我的MVC 4應用程序並將其立即重定向到login.aspx的

我猜有對MVC 4

特殊說明它們是什麼?

我在哪裏可以找到它們?

編輯

要清楚,我創建在Visual Studio 2012年一ASP.MVC 4互聯網應用的話,我使用Identity &訪問工具添加本地開發STS來測試我的應用程序。

我運行在本地IIS快遞

網站當我調試,我重定向到

本地主機的應用程序:11378/login.aspx的RETURNURL =%2F

即使我按照建議中的建議移除表單身份驗證,也會發生這種情況。

回答

9

在我的情況下,我加入這個

<system.web> 
... 
<httpModules> 
... 
    <remove name="FormsAuthentication" /> 
</httpModules> 
</system.web> 

<system.webServer> 
... 
    <modules> 
    ... 
     <remove name="FormsAuthentication" /> 
    </modules> 
</system.webServer> 

編輯

你可能會得到下一個問題是這樣的

類型 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier' 或 'http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider' 的權利要求不存在於提供ClaimsIdentity。要使用基於聲明的身份驗證啓用防僞令 令牌支持,請驗證 已配置聲明提供程序是否在其生成的 ClaimsIdentity實例上提供了這兩種聲明。如果配置的提供商使用不同的聲明類型作爲唯一標識符 ,則可以通過設置靜態屬性 AntiForgeryConfig.UniqueClaimTypeIdentifier來配置它。

在Identity這些索賠2添加到開發STS和訪問工具

http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier
http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider

這行添加到您的Global.asax

AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier; 

This article helped me

3

刪除FormsAuthentication模塊爲我工作。

<httpModules> 
    ... 
    <remove name="FormsAuthentication" /> 
</httpModules> 
+0

剛試過這個,它也適用於我。自認證以來感到困惑。模式設置爲無。 – Dismissile

+0

沒有沒有爲我工作 – Peter

+0

需要從模塊中刪除 – Peter

2

我在本地IIS Express上遇到了與我的MVC4應用程序類似的問題。

原來,Windows身份驗證已啓用該項目。禁用Windows身份驗證(在項目屬性窗格中 - 按F4)解決了問題。