c# - SignalR 在升级时导致重大问题

标签 c# .net signalr owin

两天后,我终于能够安装新的 SignalR;但是,我遇到了另一个问题。

我要么删除了特定的 Owin 程序集,要么以某种方式丢失了对它的引用。

我检查了我的 bin、包和引用文件夹,所有原始的 Owin 命名约定都可见。

谁能把我从这场悲剧中解救出来并告诉我如何解决这个问题?

这是从 iis 返回的服务器错误。

    Server Error in '/' Application.

The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- No assembly found containing a Startup or [AssemblyName].Startup class.
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.

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.EntryPointNotFoundException: The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- No assembly found containing a Startup or [AssemblyName].Startup class.
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.

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: 


[EntryPointNotFoundException: The following errors occurred while attempting to load the app.
 - No assembly found containing an OwinStartupAttribute.
 - No assembly found containing a Startup or [AssemblyName].Startup class.
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.]
   Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +357
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +28
   System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +115
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +418
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): The following errors occurred while attempting to load the app.
 - No assembly found containing an OwinStartupAttribute.
 - No assembly found containing a Startup or [AssemblyName].Startup class.
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.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9874840
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

最佳答案

这是因为运行时无法检测程序集中的启动类。在你的项目中尝试添加一个程序集级别的属性来指定你的启动类

[assembly: OwinStartup(typeof(YourStartupClass))]. 

或者,您可以在 web.config 中将启动类指定为 appSetting,例如:

<appSettings>
 <add key="owin:AppStartup" value="<FullyqualifiednameofStartupclass>,<assemblyName>" />
</appSettings>

有关启动类检测的更多信息,请参阅 this教程。

关于c# - SignalR 在升级时导致重大问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19814213/

相关文章:

c# - ResolveUrl 和 ResolveClientUrl 有什么区别?

asp.net - WCF 服务调用仅在 Fiddler 运行时有效

c# - 在 ThreadPool 中的线程上调用 Thread.Abort

javascript - 如何在客户端处理 SignalR 服务器异常?

c# - SignalR HubConnectionState = 正在连接

c# - Asp.Net MVC 5.1网站在线聊天解决方案

c# - Linq 到 SQL : Where clause comparing a Nullable<DateTime> with a SQL datetime null column

c# - 如何使用 C# 检查 datagridview 中的空单元格和空单元格

C#:如何调用在另一个线程内的 if 语句中返回类型的函数?

c# - System.Data.OracleClient 不适用于 64 位 Oracle 客户端