我对 asp.net mvc 中的 SignalR 有疑问 我在下面添加一个包:
并添加 Startup.cs
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(Paksh.Startup))]
namespace Paksh
{
public class Startup
{
public static void ConfigureSignalR(IAppBuilder app)
{
app.MapSignalR();
}
}
}
但我得到错误:
The following errors occurred while attempting to load the app. - The OwinStartupAttribute.FriendlyName value '' does not match the given value 'ProductionConfiguration' in Assembly 'Paksh, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. - The given type or method 'ProductionConfiguration' was not found. Try specifying the Assembly. 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 given [...] method 'ProductionConfiguration' was not found.
表示OWIN Startup Class Detection正在根据您提供的类型 (Paksh.Startup
) 寻找名为 ProductionConfiguration
的方法,但找不到。有些东西告诉我你的 web.config 中也有类似的东西:
<appSettings>
<add key="owin:appStartup" value="ProductionConfiguration" />
</appSettings>
你有几种选择来解决这个问题:
- 将
ConfigureSignalR
方法的名称更改为ProductionConfiguration
- 在
OwinStartupAttribute
中指定正确的方法名称:[程序集:OwinStartup(typeof(Paksh.Startup), "ConfigureSignalR")]
要了解 OWIN 启动类检测,请阅读更多 here .
关于c# - OwinStartup 和在 asp.net mvc 的 signalr 中启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22608019/