Version SignalR 2.0.0-beta2 Could not load type... error! #2242

Closed
anhln8x opened this Issue Jun 29, 2013 · 14 comments

Comments

Projects
None yet

anhln8x commented Jun 29, 2013

Server Error in '/' Application.

Could not load type 'Microsoft.AspNet.SignalR.Hosting.IWebSocketRequest' from assembly 'Microsoft.AspNet.SignalR.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.TypeLoadException: Could not load type 'Microsoft.AspNet.SignalR.Hosting.IWebSocketRequest' from assembly 'Microsoft.AspNet.SignalR.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[TypeLoadException: Could not load type 'Microsoft.AspNet.SignalR.Hosting.IWebSocketRequest' from assembly 'Microsoft.AspNet.SignalR.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
Microsoft.Owin.Host.SystemWeb.<>c__DisplayClass1.b__0(Exception ex) +73
Microsoft.Owin.Host.SystemWeb.Utils.RethrowWithOriginalStack(Exception ex) +37
Microsoft.Owin.Host.SystemWeb.CallContextAsyncResult.End(IAsyncResult result) +153
Microsoft.Owin.Host.SystemWeb.OwinHttpHandler.EndProcessRequest(IAsyncResult result) +34
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9628700
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18045

Owner

davidfowl commented Jun 29, 2013

What verions of EVERYTHING are you using? Try uninstalling everything and resintstalling everything. Deleting the bin folder and starting over. You probably just have old assemblies hanging around. Take a look at the release notes http://www.asp.net/vnext/overview/latest/release-notes#TOC13 for the list of changes.

borekb commented Jul 25, 2013

Just encountered the same issue, tried to delete "packages" folder, do a NuGet restore but I'm still seeing the same error (TypeLoadException: Could not load type 'Microsoft.AspNet.SignalR.Hosting.IWebSocketRequest' from assembly 'Microsoft.AspNet.SignalR.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35').

So maybe it is a bug?

Owner

davidfowl commented Jul 25, 2013

I'm not convinced it's a bug. If you can provide repro steps installing on a clean project then we'll take a look. These types of issues happen when people are updating and have old binaries hanging around or end up mixing versions of SignalR in the same project. The fix is really simple. Uninstall SignalR and reinstall it.

borekb commented Jul 26, 2013

To follow up, the error was caused by the fact that we had the original Global.asax in place with the MapHubs() method. When we updated this file to the new method of configuring SignalR (the Startup class), the issue was gone.

I'm getting the same problem. I've uninstalled and reinstalled everything three times now. Could you explain a bit more about your last comment? Is there a new method of configuring?

It worked when I installed with Package Manager Console, not NuGet. Different versions!

Didn't have the same issue, but wasn't able to get 2.0 beta working until I changed the project from using the visual studio developer server (cassini) to local IIS Web server.

Looks like something in the 2.0 build causes a "System.PlatformNotSupportedException: This operation requires IIS integrated pipeline mode." error.

I didn't catch that until I actually visited the "/signalr/hubs" link my browser and saw the error. Now my app works as it did before.

Bobris commented Aug 10, 2013

Had same problem, I included probably obsolete package SignalR OWIN, but now only SignalR Core itself constains all needed stuff for Owin integration.

Owner

davidfowl commented Aug 10, 2013

Yep. We might need to consider creating an empty package.

@davidfowl davidfowl reopened this Aug 10, 2013

@ghost ghost assigned abnanda1 Aug 10, 2013

Owner

davidfowl commented Aug 10, 2013

@abnanda1 I'm giving you this one. We need to create a few dummy packages to make the upgrade from 1.x to 2.x smoother. The packages that we removed were:

  • Microsoft.AspNet.SignalR.Owin
  • Microsoft.AspNet.SignalR.SystemWeb

We have a few options but the first step would be to produce 2.0 versions of those packages. Step 2 is to figure out if we create dummy APIs and mark them as obsolete, or we just have dummy assemblies with no APIs with a package description that just says this package can be removed.

@DamianEdwards enough people are running into this that we'll need to do something for RTW.

@ghost ghost assigned NTaylorMullen Aug 15, 2013

Owner

davidfowl commented Aug 15, 2013

This is yours @NTaylorMullen

NTaylorMullen added a commit that referenced this issue Aug 15, 2013

Re-added a SystemWeb package to allow for a better update scenario.
- SignalR.Core will fail to update properly if updated individually.

#2242

@ghost ghost assigned gustavo-armenta Aug 15, 2013

Owner

davidfowl commented Aug 16, 2013

So we didn't exactly fix this but we made it a bit better. We're bringing back the System.Web package and marking methods obsolete. When you update Microsoft.AspNet.SignalR.Core by itself in a project that has Microsoft.AspNet.SignalR.Owin, you'll still get this weird runtime error. To fix it, you'll have to remove the Owin package.

Contributor

gustavo-armenta commented Aug 19, 2013

Tested Scenario

  1. Updated SignalR.Core from 1.1.3 to 2.0.0.RC. I started web application and it fails with:
    Could not load type 'Microsoft.AspNet.SignalR.Hosting.IWebSocketRequest' from assembly 'Microsoft.AspNet.SignalR.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
  2. Tried to uninstall SignalR.Owin and it fails with:
    Unable to uninstall 'Microsoft.AspNet.SignalR.Owin 1.1.3' because 'Microsoft.AspNet.SignalR.SystemWeb 1.1.3' depend(s) on it.
  3. Updated SignalR.SystemWeb to 2.0.0.RC, it removed SignalR.Owin. Project failed to compile because Global.asax contains "RouteTable.Routes.MapHubs();". Compile error is:
    'System.Web.Routing.SignalRRouteExtensions.MapHubs(System.Web.Routing.RouteCollection)' is obsolete: 'Use IAppBuilder.MapSignalR in an Owin Startup class.'
  4. Deleted "RouteTable.Routes.MapHubs();"
  5. Created Startup class using "app.MapHubs();". It raises a build warning, the project compiles OK and when it runs I can access signalr/hubs
    'Owin.ObsoleteOwinExtensions.MapHubs(Owin.IAppBuilder)' is obsolete: 'Use IAppBuilder.MapSignalR in an Owin Startup class'
  6. Replaced "app.MapHubs();" to "app.MapSignalR()". Build warning disappeared as expected and I can access signalr/hubs

dharmmaurya563 commented Dec 12, 2017

Not fix yet. Check and Help me.
Error: SignalRRouteExtensions.MapHubs(RouteCollection)' is obsolete: 'Use IAppBuilder.MapSignalR in an Owin Startup class. See http://go.microsoft.com/fwlink/?LinkId=320578 for more details.' SignalRApp

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment