2013-12-19 139 views
13

我在EPiServer 7.5(MVC4框架)中遇到了SignalR 2.0的一些問題。我得到的是一個404錯誤使用IIS時SignalR 2.0錯誤/信號/集線器404(未找到)

GET http://web.com/signalr/hubs 404(未找到)

我是Windows 2012 R2服務器上託管的一切。另外值得注意的是,當從Visual Studio運行IIS Express中的所有內容時,該解決方案可運行,但在IIS 8.5中運行時不起作用。

我到目前爲止所做的是添加SingalR參考。

  • Microsoft.AspNet.SignalR.Client,2.0.0.0
  • Microsoft.AspNet.SignalR.Core,2.0.0.0
  • Microsoft.AspNet.SignalR.System.Web,2.0.0.0
  • Microsoft.OWin,2.1.0.0
  • Microsoft.OWin.Host.SystemWeb,2.1.0.0
  • Microsoft.Owin.Security,2.0.0.0
  • Owin,1.0.0.0

Startup.cs

的啓動是在應用程序啓動intitialized這樣,似乎工作。

[assembly: OwinStartup(typeof(Web.Startup))] 
namespace Web 
{ 
    public class Startup 
    { 
     #region Local variables 

     private static readonly ILog Logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 

     #endregion 

     #region Methods 

     /// <summary> 
     /// Configure SignalR 
     /// </summary> 
     /// <param name="app"></param> 
     public void Configuration(IAppBuilder app) 
     { 
      try 
      { 
       Logger.MethodCallEntry(); 

       // Any connection or hub wire up and configuration should go here 
       //app.MapSignalR(); // Doesn't work either 
       var hubConfiguration = new HubConfiguration 
       { 
        EnableDetailedErrors = true, 
        EnableJavaScriptProxies = false 
       }; 

       app.MapSignalR("/signalr", hubConfiguration); 
      } 
      catch (Exception ex) 
      { 
       Logger.Error("Failed to initialize or map SignalR", ex); 
      } 
      finally 
      { 
       Logger.MethodCallExit(); 
      } 
     } 

     #endregion 
    } 
} 

腳本包含

<script src="/Static/Frameworks/Scripts/jquery-1.10.2.js"></script> 
<script src="/Static/Frameworks/Scripts/knockout-3.0.0.js"></script> 
<script src="/Static/Frameworks/Scripts/modernizr.2.7.0.js"></script> 
<script src="/Static/Frameworks/Scripts/jquery.signalR-2.0.1.js"></script> 
<!-- also tried path ~/signalr/hubs --> 
<script src="/signalr/hubs"></script> 

這是不是從1.x的SignalR更新的解決方案!

+0

@ThiagoCustodio是的,該解決方案能正常工作在IIS Express在Visual Studio中,我可以調試startup.cs以及 –

+0

請檢查SignalR版本以及http://stackoverflow.com/questions/26750727/ signalr-hubs-404-not-found-after-update-to-mvc5/38985725#38985725 – Spirit

回答

12

錯誤是完全一樣的在這個崗位 http://blogs.msdn.com/b/praburaj/archive/2013/12/02/owin-startup-class-not-detected.aspx

的解決方案是完全空的asp.net緩存

運行此PowerShell中

net stop w3svc 
Remove-Item -Path "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\*" -Force -Recurse 
Remove-Item -Path "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\*" -Force -Recurse 
net start w3svc 
+0

我的解決方案適用於各種應用程序和主機。我的第一個應用程序已經工作了一年,但突然停止工作,同時仍在我的本地IIS中運行良好。運行此腳本後,我的應用程序在2012年再次在IIS中運行。 – ZZZ

+0

我認爲緩存中的衝突是由於我刪除了網站目錄,然後在網站仍在運行時上載了新內容而導致的。我重複了這個問題。所以上課是在更新之前關閉網站。 – ZZZ

6

我剛生了類似的問題讓「MoveShape」演示在新建的Win 2012R2服務器上運行。我通過添加角色/功能解決了這個問題:「Web服務器(IIS)」 - >「應用程序開發」並選擇「.NET Extensibility 4.5」,「ASP.NET 4.5」,「ISAPI擴展」,「ISAPI過濾器」 「WebSocket協議」。

一旦我重新啓動系統或IIS,演示開始工作。

16

只想把我的2美分,我有這個錯誤,它結束了,因爲我在web.config中有

<add key="owin:AutomaticAppStartup" value="false" /> 

。刪除這條線固定了我的一切!

+0

我也在爲同樣的問題尋找解決方案,非常感謝,菲爾這也適用於我。 :) – himanshu

+0

你能寫出你的解決方案,因爲我有問題嗎? – Ivan

0

剛剛有相同的404問題。最後,我更新了所有的DLL,除了一個問題。我沒有更新Microsoft.AspNet.SignalR.SystemWeb。dll

+0

你之前和之後有什麼版本? –

2

我的問題已通過刪除nude-package「Microsoft.Owin.Host.SystemWeb」解決,它在packages.config中以version =「2.1.0」引用並安裝version =「3.0.1」。

使用此版本的owin環境從未在服務器2012r2上的iis8上啓動,並顯示錯誤,名稱空間「主機」未找到。

Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Owin.Host.SystemWeb, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. 

Startup.cs(2,22): error CS0234: The type or namespace name 'Host' does not exist in the namespace 'Microsoft.Owin' (are you missing an assembly reference?) [*.csproj]