Skip to main content
 首页 » 编程设计

c#之WEB API 启动类异常

2024年05月10日45zhengyun_ustc

在我的 web api 中,我定义了如下启动类,

[assembly: OwinStartup(typeof(MyProject.Cache.Startup))] 
 
namespace MyProject.Cache 
{ 
    public class Startup 
    { 
        public void Configuration(IAppBuilder app) 
        { 
 
            Configuration(app); 
        } 
    } 
} 

当我运行下面的项目时出现异常,

An unhandled exception of type 'System.StackOverflowException' occurred in MyProject.Cache.dll,

有什么建议吗?

请您参考如下方法:

难道你有一个无限递归?

Configuration(IAppBuilder app) 再次调用它自己。