I don't have complex scenario as other SO questions. It is straingth one.
I created a new project in ASP.Net MVC
and installed Owin
and SignalR
. Wrote the following code
[assembly: OwinStartup(typeof(WebChat.Models.ChatHub))]
namespace WebChat.Models{
public class ChatHub : Hub
{
public void BroadcastMessage(string username, string msg)
{
Clients.All.broadcastMessage(username, msg);
}
}
}
and following code in js.
var chat = $.connection.chatHub;
chat.client.broadcastMessage = function (name, message) {
var encodedName = $('<div />').text(name).html();
var encodedMsg = $('<div />').text(message).html();
$('#discussion').append('<li><strong>' + encodedName
+ '</strong>: ' + encodedMsg + '</li>');
};
$.connection.hub.start().done(function () {
$('#sendmessage').click(function () {
chat.server.send($('#lblusername').val(), $('#txtMsg').val());
$('#txtMsg').val('').focus();
});
});
and I am getting this error
The following errors occurred while attempting to load the app. - The OwinStartup attribute discovered in assembly 'WebChat' referencing startup type 'WebChat.Startup' conflicts with the attribute in assembly 'WebChat' referencing startup type 'WebChat.Models.ChatHub' because they have the same FriendlyName ''. Remove or rename one of the attributes, 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.
I know this has been asked at many places but none solved my issue.