小编exe*_*bat的帖子

ASP.NET MVC OWIN和SignalR - 两个Startup.cs文件

我的项目有问题.

我使用ASP.NET MVC和ASP.NET Identity 2.0进行身份验证,我将SignalR添加到项目中,所以现在我有两个Startup.cs文件:

第一个来自MVC的根

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

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

和SignalR一个在AppCode文件夹中

[assembly: OwinStartup(typeof(SignalRChat.Startup))]
namespace SignalRChat
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {

            var heartBeat = GlobalHost.DependencyResolver.Resolve<ITransportHeartbeat>();

            var monitor = new PresenceMonitor(heartBeat);
            monitor.StartMonitoring();


            // Any connection or hub wire up and configuration should go here
            app.MapSignalR();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误

尝试加载应用程序时发生以下错误. - 在程序集"MCWeb-3SR"中发现的OwinStartup属性引用启动类型"MCWeb_3SR.Startup"与程序集"App_Code.hszoxs_z"中引用启动类型"SignalRChat.ChatStartup"的属性冲突,因为它们具有相同的FriendlyName''.删除或重命名其中一个属性,或直接引用所需的类型.要禁用OWIN启动发现,请在web.config中添加值为"false"的appSetting owin:AutomaticAppStartup.要指定OWIN启动程序集,类或方法,请在web.config中添加appSetting owin:AppStartup以及完全限定的启动类或配置方法名称.

我尝试添加

[assembly: OwinStartupAttribute("ProductionConfiguration.st", typeof(MCWeb_3SR.Startup))]
Run Code Online (Sandbox Code Playgroud)

到第一个,页面运行但身份验证不起作用.

我怎么能让它们一起运行?

更新

using …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc signalr owin

6
推荐指数
1
解决办法
1万
查看次数

在VS 2017更新后,Nuget已安装面板为空

我今天将VS更新为15.7.3版本,现在我的Nuget面板已经安装了包.不是空的,但只显示System.Runtime.

我的项目中有一个packages.config文件,在更新之前一切正常.

解决方案也不会构建.它显示以下错误

This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets. C:\Users\User\Source\Repos\xxxx1-sol\xxxx1\xxxx1.csproj 6039    
Run Code Online (Sandbox Code Playgroud)

可能是什么问题?

更新1

我尝试再次安装所有的软件包,在我安装了几个软件包后,我在References中看到了这个

参考窗口

更新2:

我尝试删除.packages文件夹,然后再通过Nuget再次安装软件包,并且没有创建文件夹.packages

我的项目路径是C:\ Users\User\Source\Repos\Project123-Git

另外我看到现在我在C:\ Users\User.nuget中有一个文件夹.nuget,其中包含文件夹包.

我也尝试删除文件packages.config,但即使packages.config不存在,Nuget仍然有我新安装的软件包

asp.net visual-studio nuget visual-studio-2017

6
推荐指数
1
解决办法
354
查看次数