我一直在使用DotNetOpenAuth很多。首先,我們使用5.0.0-alpha1,但我們切換到v4.0.30319,因爲我們無法找到導致我們問題的原因。DotNetOpenAuth不適用於MVC 5 RC
我們正在Visual Studio 2013中使用MVC 5 RC在.NET 4.5.1 RC上構建C#Web API項目。我們已實施IAuthorizationServerHost
,INonceStore
和ICryptoKeyStore
。
是我們的問題是圍繞着以下情況:
public class TokensController : Controller
{
private readonly AuthorizationServer authorizationServer = new AuthorizationServer(new MyAuthorizationServer());
/// <summary>
/// This action will handle all token requests.
/// </summary>
/// <returns>The action result that will output the token response.</returns>
[HttpPost]
public ActionResult Index()
{
var outgoingWebResponse = this.authorizationServer.HandleTokenRequest(this.Request);
return outgoingWebResponse.AsActionResult();
}
}
return outgoingWebResponse.AsActionResult();
一個在DotNetOpenAuth.Messaging
起源和MessagingUtilities
靜態類方法。 DotNetOpenAuth.Core
(包含此代碼)引用MVC 4.0,而HttpResponseMessageActionResult
類繼承自ActionResult
。
這意味着DotNetOpenAuth的當前版本與MVC 5不兼容。編譯並嘗試運行此操作只會出現500個錯誤。
有沒有人有任何想法如何可以很容易地修復(或可能不)?
我沒有注意到DotNetOpenAuth Nuget包在我的包上寫了5.0。因此,重新安裝包,再加入assemblyBinding後:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
這讓我們遠一點。現在的錯誤歸結爲:
嘗試通過安全透明的方法「DotNetOpenAuth.Messaging.MessagingUtilities.AsActionResult(DotNetOpenAuth.Messaging.OutgoingWebResponse)」訪問安全關鍵型「System.Web.Mvc.ActionResult失敗。
我剛剛升級到MVC5並崩潰到這個問題。環顧四周,我驚訝地發現AA已經放棄了這個項目。由於很長一段時間沒有釋放,我無法確定DNOA是否正在積極開發。項目的狀態如何?你還在使用DNOA嗎? – Jammer