Fehler in owin startup class visual studio 2012

Ich bin neu auf-signal r und ich bin versucht, erstellen Sie eine einfache chat-Anwendung in c# visual studio 2012, aber ich bin immer folgende Fehlermeldung.

The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- The discovered startup type 'SignalRTutorials.Startup, SignalRTutorials, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' 
    conflicts with the type 'Microsoft.VisualStudio.Web.PageInspector.Runtime.Startup, Microsoft.VisualStudio.Web.PageInspector.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. 
 Remove or rename one of the types, or reference the desired type directly. 
 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.

Erstellt habe ich 3 Dateien:

1) zunächst ist Letschat.cs Klasse:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
namespace SignalRTutorials
{
    [HubName("myChatHub")]
    public class LetsChat:Hub
    {
        public void send(string message)
        {

            Clients.All.addMessage(message);

        }
    }
}

2) die zweite Datei chat.aspx als

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Chat.aspx.cs" Inherits="SignalRTutorials.Chat" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.6.4.min.js"></script>
    <script src="Scripts/jquery-1.6.4-vsdoc.js"></script>
    <script src="Scripts/jquery-1.6.4.min.js"></script>
    <script src="Scripts/jquery.signalR-2.0.0.js"></script>
    <script src="Scripts/jquery.signalR-2.0.0.min.js"></script> 
</head>
<body>
    <form id="form1" runat="server">
         <script type="text/javascript">

             $(function()
             {
                 var IWannaChat=$.connection.myChatHub;
                 IWannaChat.client.addMessage=function(message){

                     $('#listMessages').append('<li>'+message+'</li>');
                 };
                 $("#SendMessage").click(function(){
                     IWannaChat.server.send($('#txtMessage').val());
                 });
                 $.connection.hub.start();
             });


         </script>
    <div>
    <input type="text" id="txtMessage" />
         <input type="text" id="SendMessage" value="broadcast" />
        <ul id="listMessages">



        </ul>
    </div>
    </form>
</body>
</html>

3) wird die Klasse als Startup.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Web;
using System.Web.Routing;
using Microsoft.AspNet.SignalR;
using Microsoft.Owin.Security;
using Owin;


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

    }
}

Ich weiß nicht, wo ich falsch mache jede Hilfe in dieser Hinsicht dankbar sein.

Welche Versionen von .NET und SignalR verwenden Sie?
.net 4.5, visual studio 2012 und das signal r 2.0
Können Sie versuchen, hinzufügen einer assembly level-Attribut [assembly: OwinStartup(typeof(SignalRTutorials.Start))], um zu sehen, ob dies das problem löst?

InformationsquelleAutor | 2013-11-28

Schreibe einen Kommentar