SignalR导致升级时出现重大问题

时间:2013-11-06 14:07:24

标签: 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

3 个答案:

答案 0 :(得分:15)

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

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

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

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

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

答案 1 :(得分:6)

或者仅仅是因为缺少startup.cs文件,当您使用身份验证创建新项目时,该文件通常由asp.net mvc模板创建。

它发生在我身上,因为我没有选择添加身份验证。

要解决此问题,只需在项目的 root 中添加 startup.cs 文件,如下所示:

using Microsoft.Owin;
using Owin;

[assembly: OwinStartupAttribute(typeof(MyProjectNamespace.Startup))]
namespace MyProjectNamespace
{
    public partial class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.MapSignalR();
            //ConfigureAuth(app);
        }
    }
}

它应该有用。

它可以替代接受的答案。

答案 2 :(得分:-2)

只需下载owin.dll并将其放在应用的bin文件夹中即可!

http://owin.org/