2012-11-19 15 views
6

私は以下の設定をしています。私は別の<system.webServer />セクションを追加した場合なぜServiceStackはこの設定で404を返しますか?

<location path="services"> 
    <system.web> 
    <httpHandlers> 
     <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" /> 
    </httpHandlers> 
    <authorization> 
     <allow users="*"/> 
    </authorization> 
    </system.web> 
    <!-- Required for IIS 7.0 --> 
    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true" /> 
    <validation validateIntegratedModeConfiguration="false" /> 
    <handlers> 
     <add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" /> 
    </handlers> 
    </system.webServer> 
</location> 

は、ないlocation要素内に、ServiceStackは、すべての要求に対して404を返します。それを取り除くと、すべてが再び機能します。ここで

は、例えば、応答です:

 
HTTP/1.1 404 Not Found 
Cache-Control: private 
Content-Type: text/plain; charset=utf-8 
Server: Microsoft-IIS/7.5 
X-Powered-By: ServiceStack/3.926 Win32NT/.NET 
X-AspNet-Version: 4.0.30319 
X-Powered-By: ASP.NET 
Date: Mon, 19 Nov 2012 23:15:46 GMT 
Content-Length: 1528 

Handler for Request not found: 


Request.ApplicationPath: /MyWebApp.Web.UI 
Request.CurrentExecutionFilePath: /MyWebApp.Web.UI/services/echo/ 
Request.FilePath: /MyWebApp.Web.UI/services/echo/ 
Request.HttpMethod: GET 
Request.MapPath('~'): D:\Lib\MyWebApp\2013\MyWebApp\MyWebApp.Web.UI 
Request.Path: /MyWebApp.Web.UI/services/echo/ 
Request.PathInfo: 
Request.ResolvedPathInfo: /services/echo 
Request.PhysicalPath: D:\Lib\MyWebApp\2013\MyWebApp\MyWebApp.Web.UI\services\echo\ 
Request.PhysicalApplicationPath: D:\Lib\MyWebApp\2013\MyWebApp\MyWebApp.Web.UI\ 
Request.QueryString: 
Request.RawUrl: /MyWebApp.Web.UI/services/echo/ 
Request.Url.AbsoluteUri: http://localhost/MyWebApp.Web.UI/services/echo/ 
Request.Url.AbsolutePath: /MyWebApp.Web.UI/services/echo/ 
Request.Url.Fragment: 
Request.Url.Host: localhost 
Request.Url.LocalPath: /MyWebApp.Web.UI/services/echo/ 
Request.Url.Port: 80 
Request.Url.Query: 
Request.Url.Scheme: http 
Request.Url.Segments: System.String[] 
App.IsIntegratedPipeline: True 
App.WebHostPhysicalPath: D:\Lib\MyWebApp\2013\MyWebApp\MyWebApp.Web.UI 
App.WebHostRootFileNames: [global.asax,global.asax.cs,header.html,list.html,login.html,MyWebApp.web.ui.csproj,MyWebApp.web.ui.csproj.user,packages.config,web.config,bin,humanresources,js,obj,properties,styles,_sgbak] 
App.DefaultHandler: DefaultHttpHandler 
App.DebugLastHandlerArgs: GET|/MyWebApp.Web.UI/services/echo/|D:\Lib\MyWebApp\2013\MyWebApp\MyWebApp.Web.UI\services\echo\ 

は、別のsystem.webServerセクションを持つことが可能ではないですか? IISのURL書き換えルールを追加したいと思います。

答えて

4

追加のsystem.webServer宣言が、Web.ConfigからのホストされたパスのServiceStackの自動推論に干渉している可能性があります。

あなたは(あなたのAppHost.Configureに例えば、それが助けかどうかを確認するために、手動でパスを設定してみてください):

SetConfig(new HostConfig { 
    HandlerFactoryPath = "services", 
}); 
+0

それのように見えます。修正プログラム(と素晴らしいライブラリ)をありがとう。 – Daniel

+0

thx :) kool、それはうれしかった。 – mythz

+0

Riaサービスを使用してSilverlightで同じ問題が発生しました。 – epitka

関連する問題