2012-02-16 25 views
2

我在配置我的ServiceStack REST服務以在我的生產IIS 7.5框上工作時遇到問題。它工作正常運行本地主機,它也工作正常,如果我部署在「默認網站」 -/EmployeeSvc的根。爲了組織目的,我在Default Web Site下有一個虛擬目錄結構(注意web.config中的自定義路徑)。我可以成功瀏覽到此位置的default.htm,但是當我嘗試執行我收到的內置/ hello示例時:ServiceStack REST服務自定義路徑錯誤

服務器錯誤404 - 找不到文件或目錄。 您正在查找的資源可能已被刪除,名稱已更改或暫時不可用。

就像我說過的,內置/ hello示例完全可以從本地主機和默認web站點下的根iis文件夾完成,但不能從目錄結構中完成。我在做什麼錯誤的位置路徑?

在此先感謝!這裏是web.config中:

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 

    <location path="Employees-NoAuth/WebServices/EmployeeSvc"> 
     <system.web> 
      <httpHandlers> 
      <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" /> 
      </httpHandlers> 
     </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" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" verb="*" /> 
      </handlers> 
     </system.webServer> 
    </location> 

    <system.web> 
    <customErrors mode="RemoteOnly"/> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 

</configuration> 
+0

注:「服務器錯誤404 - 文件或目錄未找到」是一個ASP.NET錯誤,即你的路徑是不是做對ServiceStack處理程序 - 這是需要解決的第一件事。 – mythz 2012-02-16 18:30:50

+0

我對servicestack很新,​​但是你有沒有機會在你的web.config中增加system.webServer條目?沿着ria服務使用服務堆棧時遇到了同樣的問題。如果你確實讓我知道,我會告訴你該怎麼做。 – epitka 2013-03-22 13:52:28

回答

0

我會嘗試以下方法:從web.config中
1.拆下位置節點。移出SS配置。在類
2.註冊基本URL路徑從AppHostBase得出:

public override void Configure(Container container) 
{ 
    this.SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "base/path" }); 
}