我复制了以前的项目并将其重命名。一旦我成功重命名所有名称空间并正确构建。运行应用程序时出现以下错误:
The following errors occurred while attempting to load the app.
- The OwinStartup attribute discovered in assembly 'User Manager Interface' referencing startup type 'User_Manager_Interface.Startup' conflicts with the attribute in assembly 'Service Monitor Web Interface' referencing startup type 'Service_Monitor_Web_Interface.Startup' 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.
我已经发现,如果我将下面的第一行注释掉,那么错误就会消失。
//[assembly: OwinStartupAttribute(typeof(Service_Monitor_Web_Interface.Startup))]
namespace Service_Monitor_Web_Interface
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
}
}
我将我的解决方案从User_Manager_Interface重命名为Service_Monitor_Web_Interface。
我似乎无法找到任何具有旧名称的地方,但是它提到的错误如何。
答案 0 :(得分:166)
我已经有过几次这个问题,所以我会写下我遵循的程序,以提醒自己:
答案 1 :(得分:30)
如果在同一bin文件夹中有两个包含OwinStartup类的程序集,则会出现此问题。通常,您不应该为同一个Web应用程序使用两个OwinStartup类。
您可以通过检查bin文件夹来解决此问题。如果在重命名后,具有旧名称的程序集仍保留在bin文件夹中,则会出现此错误。要解决此问题,请从bin文件夹中删除所有内容。
答案 2 :(得分:12)
重命名解决方案的程序集后,我遇到了同样的问题。
我通过确保OwinStartupAttritbute引用我的新程序集名称来解决。
接下来是删除bin文件夹中的旧程序集。
答案 3 :(得分:8)
我没有重命名我的解决方案,但我遇到了这个问题。我无法在任何地方找到解决方案。我在同一台服务器上有一个owin启动类的2个独立项目。我只是给每个人一个不同的友好名字"正如异常消息中所建议的那样,它解决了它。我发现了一篇很好的文章:
要重命名它,您需要做的就是在OwinStartup上添加一个字符串,如下所示:
[assembly:OwinStartup(" ProductionConfiguration",typeof(StartupDemo.ProductionStartup2))]
答案 4 :(得分:3)
在网络配置appsetting
上添加以下标记XpsDocument xpsDoc = new XpsDocument(Path, FileAccess.Read);
FixedDocumentSequence document = xpsDoc.GetFixedDocumentSequence();
frame.Source = ((System.Windows.Markup.IUriContext)document).BaseUri;
答案 5 :(得分:1)
我有两个ASP .NET MVC 5项目,Project1和Project2。
问题是两个项目的DLL都在同一个bin文件夹中,并且都使用Owin中间件。这意味着Project1.dll和Project2.dll存在于Project2的同一bin文件夹中。
由于我在每个项目中只需要其中一个,所以我只删除Project2 bin文件夹中未使用的Project1.dll。
答案 6 :(得分:0)