【问题标题】:SignalR causing major issues on upgradeSignalR 导致升级时出现重大问题
【发布时间】:2014-06-02 14:59:17
【问题描述】:

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

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

我检查了我的 bin、packages 和 reference 文件夹,所有原始 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

【问题讨论】:

  • 您是否使用nuget 来管理此问题?
  • 提示:如果通过玩具示例收到此错误消息,请确保您的 index.html(或其他)页面在 Visual Studio 中被标记为起始页面。

标签: c# .net signalr owin


【解决方案1】:

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

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

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

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

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

【讨论】:

  • 是的,刚刚找到。伙计,这么简单的任务太麻烦了。
【解决方案2】:

或者只是因为在您创建具有身份验证的新项目时,缺少通常由 asp.net mvc 模板创建的 startup.cs 文件。

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

要解决这个问题,只需在项目的 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);
        }
    }
}

它应该可以工作。

这是公认答案的替代方案。

【讨论】:

    【解决方案3】:

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

    http://owin.org/

    【讨论】:

    • 它在我的垃圾箱里,我已经引用了它。
    猜你喜欢
    • 1970-01-01
    • 2021-01-17
    • 2011-10-08
    • 1970-01-01
    • 1970-01-01
    • 2014-05-21
    • 1970-01-01
    • 2023-04-01
    • 1970-01-01
    相关资源
    最近更新 更多