'Owin.IAppBuilder' does not contain a definition for 'MapSignalR'
Solution 1
Only install this nuget:
Install-Package Microsoft.AspNet.WebApi.OwinSelfHost
Solution 2
Finally was able to solve it by adding signalR dependencies before adding signalR from NuGet Packages
Step's I followed:
- Added Microsoft.Owin
//version 2.0.1
- Added Microsoft.Owin.Security
//version 2.0.1
- Added Microsoft Asp.Net SignalR
The reason I discovered was a problem with version 2.0.2
of Microsoft.Owin and Microsoft.Owin.Security and then adding a class named Startup.cs
with following code:
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(webApp.Startup))]
namespace webApp
{
public static class Startup
{
public static void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
}
Directly adding Microsoft Asp.Net SignalR
from NuGet adds version 2.0.2 of Microsoft.Owin and Microsoft.Owin.Security
which creates the problem.
Hope it helps someone...!!
Solution 3
Update-Package Owin -Reinstall
worked for me
Solution 4
Install Nuget Package: Microsoft.AspNet.Identity.Owin
Solution 5
Using MVC5, enter your Startup.cs file.
Add IAppBuilder appBuilder
to Configure()
:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IAppBuilder appBuilder)
{
Then, under
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
add appBuilder.MapSignalR();
Bhavik
Updated on November 20, 2021Comments
-
Bhavik over 2 years
Error
'Owin.IAppBuilder' does not contain a definition for 'MapSignalR' and no extension method 'MapSignalR' accepting a first argument of type 'Owin.IAppBuilder' could be found (are you missing a using directive or an assembly reference?)
Code
using Microsoft.Owin; using Owin; [assembly: OwinStartup(typeof(SignalRChat.Startup))] namespace SignalRChat { public class Startup { public void Configuration(IAppBuilder app) { // Any connection or hub wire up and configuration should go here app.MapSignalR(); } } }
Any help would be greatly appreciated...
Update
signalR version 2.0.3
Microsoft Owin version 2.0.2
Owin version 1.0.0
Visual Studio 2012 -
chavakane almost 10 yearsThanks! You saved me from getting very frustrated on a Friday night!
-
Greg Bogumil about 9 yearsFYI as of 2/15/2015 this seems to have been resolved. I only installed Microsoft.AspNet.SignalR directly and the above worked fine.
-
Bhavik about 9 yearsThis is an old solution. Do refer the answer by @mggSoft for the latest answer.
-
jward01 over 8 yearsWorked for me too thank you. I tried the other solutions above and they did not work. This one did.
-
feganmeister almost 7 yearsNeed to install this nuget too: Install-Package Microsoft.Owin.Cors -Version 3.1.0
-
S.Mohamed Mahdi Ahmadian zadeh about 6 yearsThank you so much my friend... your solution solved my problem which I was working for 1 hours...