我用VS2012在Nuget中安装Signalr之后报错

时间:2023-03-08 16:45:54

我用VS2012在Nuget中安装Signalr之后报错

“/”应用程序中的服务器错误。


The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- No 'Configuration' method was found in class 'Microsoft.VisualStudio.Web.PageInspector.Runtime.Startup, Microsoft.VisualStudio.Web.PageInspector.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.
To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.

解决办法:

The template produces such a class:

using System;
using System.Threading.Tasks;
using Microsoft.Owin;
using Owin; [assembly: OwinStartup(typeof(WebApiOsp.App_Start.Startup))] namespace WebApiOsp.App_Start
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
app.MapSignalR();
}
}
}

或者:

Web.config添加

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

http://*.com/questions/20068075/owin-startup-class-missing