在我的项目中实现信号R的问题

时间:2014-10-02 10:51:53

标签: c# asp.net signalr

我需要在我的asp.net项目中实现信号R,以便向员工发送通知。但是我遇到了owinstartup的问题。我收到这样的错误:

   The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- The given type or method 'Notify' 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.

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.
- The given type or method 'Notify' 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.

我的sartup课程是这样的:

using Microsoft.Owin;
using Owin;
[assembly: OwinStartup("Notify",typeof(CRMWeb.Startup))]
namespace CRMWeb
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            // Any connection or hub wire up and configuration should go here
            app.MapSignalR();
        }
    }
}

我已将此行添加到我的web.config中的appsetting

 <add key="owin:appStartup" value="Notify" />  

1 个答案:

答案 0 :(得分:0)

无需在OwinStartup程序集中“通知”。只需添加从microsoft记录的启动类。

试试这个:

[assembly: OwinStartup(typeof(CRMWeb.Startup))]

namespace CRMWeb
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.MapSignalR();
        }
    }
}