将owin类库部署到iis会导致404

时间:2014-11-04 11:05:13

标签: .net iis-7.5 owin

我将404部署到具有4.0集成管道的IIS网站之后获得404。我尝试访问某些网络API路由,如https://appname.domainname.com/api/v1/SomeObject/GetAll

作为控制台应用程序,它工作正常。

我的启动文件

[assembly: OwinStartup(typeof(XXX.Owin.Startup))]
namespace XXX.Owin
{
    public class Startup
    {
        private static readonly Logger s_logger = LogManager.GetCurrentClassLogger();

        public void Configuration(IAppBuilder appBuilder)
        {
            s_logger.Info("Start");

            HttpConfigurationManager httpConfigurationManager = new HttpConfigurationManager();
            HttpConfiguration httpConfiguration = httpConfigurationManager.Create();

            appBuilder.UseStageMarker(PipelineStage.Authenticate);

            appBuilder.Use(async (ctx, next) =>
            {
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();

                await next();

                stopwatch.Stop();
                Console.WriteLine("Request took: {0}", stopwatch.ElapsedMilliseconds);
            });


            appBuilder.Use<CustomHeadersComponent>();
            appBuilder.Use<SecurityComponent>();
            appBuilder.UseWebApi(httpConfiguration);
        }
    }

我应该添加web.config吗? 将app.config更改为web.config? 也许我不能创建iis站点并设置owin目录的物理路径?

1 个答案:

答案 0 :(得分:0)

问题是该项目是Windows库而不是Web应用程序。