2016-07-30 9 views
0

私はOwinSelfHostで動作するOWIN WebAPIプロジェクトを持っていますが、IIS 10でホストされている場合は常に404となります。 html。私はWindows 10マシンでIIS 10を実行しています。 Dapper、Npgsql、Postgresqlデータベースを使用しています。IIS 10のOWIN WebApiプロジェクトはすべての操作で404を返します

私はこれまでのところ、運が、ここに私のWeb.configファイルではありません、私はグーグルを読んでいくつかのトリックを試してみました:

<?xml version="1.0" encoding="utf-8"?> 
<!-- 
    For more information on how to configure your ASP.NET application, please visit 
    http://go.microsoft.com/fwlink/?LinkId=169433 
    --> 
<configuration> 
    <system.web> 
     <compilation debug="true" targetFramework="4.6" /> 
     <httpRuntime targetFramework="4.6" /> 
     <httpModules> 
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /> 
     </httpModules> 
    </system.web> 

    <system.webServer> 
     <!-- runAllManagedModulesForAllRequests: Make sure that we have OWIN handle static files, too. --> 
     <modules runAllManagedModulesForAllRequests="true"> 
      <remove name="ApplicationInsightsWebTracking" /> 
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" /> 
     </modules> 

     <staticContent> 
      <!--clear /--> 
     </staticContent> 


     <handlers> 
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> 
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> 
     </handlers> 
     <validation validateIntegratedModeConfiguration="false" /> 
     <directoryBrowse enabled="true" /> 
     <defaultDocument> 
      <files> 
       <add value="public/index.html" /> 
      </files> 
     </defaultDocument> 
    </system.webServer> 

    <runtime> 
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
      <dependentAssembly> 
       <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
       <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> 
      </dependentAssembly> 
      <dependentAssembly> 
       <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> 
       <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /> 
      </dependentAssembly> 
      <dependentAssembly> 
       <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
       <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /> 
      </dependentAssembly> 
      <dependentAssembly> 
       <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
       <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /> 
      </dependentAssembly> 
     </assemblyBinding> 
    </runtime> 
</configuration> 

そしてpackages.config:

<?xml version="1.0" encoding="utf-8"?> 
<packages> 
    <package id="Dapper" version="1.50.1" targetFramework="net46" /> 
    <package id="Dapper.Contrib" version="1.50.0" targetFramework="net46" /> 
    <package id="Dapper-Async" version="1.03" targetFramework="net46" /> 
    <package id="Microsoft.ApplicationInsights" version="2.0.0" targetFramework="net46" /> 
    <package id="Microsoft.ApplicationInsights.Agent.Intercept" version="1.2.1" targetFramework="net46" /> 
    <package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.0.0" targetFramework="net46" /> 
    <package id="Microsoft.ApplicationInsights.JavaScript" version="0.22.9-build00167" targetFramework="net46" /> 
    <package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.0.0" targetFramework="net46" /> 
    <package id="Microsoft.ApplicationInsights.Web" version="2.0.0" targetFramework="net46" /> 
    <package id="Microsoft.ApplicationInsights.WindowsServer" version="2.0.0" targetFramework="net46" /> 
    <package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.0.0" targetFramework="net46" /> 
    <package id="Microsoft.AspNet.Cors" version="5.2.3" targetFramework="net46" /> 
    <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net46" /> 
    <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net46" /> 
    <package id="Microsoft.AspNet.WebApi.Cors" version="5.2.3" targetFramework="net46" /> 
    <package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net46" /> 
    <package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net46" /> 
    <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net46" /> 
    <package id="Microsoft.Azure.AppService.ApiApps.Service" version="0.9.16" targetFramework="net46" /> 
    <package id="Microsoft.Owin" version="3.0.1" targetFramework="net46" /> 
    <package id="Microsoft.Owin.FileSystems" version="3.0.1" targetFramework="net46" /> 
    <package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net46" /> 
    <package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net46" /> 
    <package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net46" /> 
    <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net46" /> 
    <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net46" /> 
    <package id="Npgsql" version="3.1.6" targetFramework="net46" /> 
    <package id="Owin" version="1.0" targetFramework="net46" /> 
    <package id="OwinHost" version="3.0.1" targetFramework="net46" /> 
    <package id="Swashbuckle" version="5.0.0" targetFramework="net46" /> 
    <package id="Swashbuckle.Core" version="5.0.0" targetFramework="net46" /> 
    <package id="System.IdentityModel.Tokens.Jwt" version="4.0.0" targetFramework="net46" /> 
    <package id="WebActivatorEx" version="2.0.6" targetFramework="net46" /> 
</packages> 
+0

asp.netに登録しましたか?そうでない場合は、管理者としてVisual Studioのコマンドラインツールを使用して 'aspnet_regiis -i'を試してください。 –

+0

@Khan私はそれを試してみました。サイトを削除してサイトを再度追加しました。 – user1510580

+0

サイトを削除することではなく、asp.netをIISに登録することです。 –

答えて

1

あなたが持っていますパイプラインにOwinHttpHandlerを追加する:

<handlers> 
     <add name="Owin" verb="*" path="*" type="Microsoft.Owin.Host.SystemWeb.OwinHttpHandler, Microsoft.Owin.Host.SystemWeb" /> 
</handlers> 
関連する問題