栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > .Net

.Net FW上线报错:The OwinStartup attribute discovered in assembly ‘AppName‘.

.Net 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

.Net FW上线报错:The OwinStartup attribute discovered in assembly ‘AppName‘.

阅文时长| 2.32分钟字数统计| 3726.4字符
主要内容| 1、引言&背景 2、解决方案 3、声明与参考资料
『.Net FW上线报错:The OwinStartup attribute discovered in assembly 'AppName'.』
编写人| SCscHero 编写时间| 2022/2/18 PM8:20
文章类型| 系列完成度| 已完成
座右铭每一个伟大的事业,都有一个微不足道的开始。
一、引言&背景   完成度:100% a) 应对问题

近日上线遇到个问题,主要异常为:The OwinStartup attribute discovered in assembly ‘AppName’ referencing startup type ‘AppName.Startup’ conflicts with the attribute in assembly ‘AppName’ referencing startup type ‘AppName.Startup’ because they have the same FriendlyName ‘’.Remove or rename one of the attributes, or reference the desired type directly.看异常描述和一个OwinStartup的依赖项有关。

详细异常信息如下:

Server Error in '/' Application.
The following errors occurred while attempting to load the app.
- The OwinStartup attribute discovered in assembly 'SCOnlineWeb' referencing startup type 'SCOnlineWeb.Startup' conflicts with the attribute in assembly 'SCOnlineHosting' referencing startup type 'SCOnlineHosting.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.
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.
- The OwinStartup attribute discovered in assembly 'SCOnlineWeb' referencing startup type 'SCOnlineWeb.Startup' conflicts with the attribute in assembly 'SCOnlineHosting' referencing startup type 'SCOnlineHosting.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.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[EntryPointNotFoundException: The following errors occurred while attempting to load the app.
 - The OwinStartup attribute discovered in assembly 'SCOnlineWeb' referencing startup type 'SCOnlineWeb.Startup' conflicts with the attribute in assembly 'SCOnlineHosting' referencing startup type 'SCOnlineHosting.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.]
   Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +470
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +37
   System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +135
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +160
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +580
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +165
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +267
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +341

[HttpException (0x80004005): The following errors occurred while attempting to load the app.
 - The OwinStartup attribute discovered in assembly 'SCOnlineWeb' referencing startup type 'SCOnlineWeb.Startup' conflicts with the attribute in assembly 'SCOnlineHosting' referencing startup type 'SCOnlineHosting.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.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3770.0

b) 应用场景
  • .Net FW项目异常。
二、解决方案   完成度:100% a) 分析检查

检查是否有引用Microsoft.Owin的依赖,如有则需要配置了。

using Microsoft.Owin;
using Microsoft.Owin.Builder;
using Owin;

[assembly: OwinStartupAttribute(typeof(SCOnlineHosting.Startup))]
namespace SCOnlineHosting
{
    public partial class Startup {
        public void Configuration(AppBuilder app) {
            ConfigureAuth(app);
        }
    }
}
b) 配置web.config

可在配置文件中添加appsetting:


三、声明与参考资料   完成度:100%

原创博文,未经许可请勿转载。

如有帮助,欢迎点赞、收藏、关注。如有问题,请评论留言!如需与博主联系的,直接博客私信SCscHero即可。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/955319.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号