我有以下配置。
<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>
如果我添加另一个<system.webServer />
部分,而不是在location
元素内,ServiceStack 会为所有请求返回 404。删除它,一切都会重新开始。
这是一个示例响应:
HTTP/1.1 404 未找到 缓存控制:私有 内容类型:文本/纯文本;字符集=utf-8 服务器:Microsoft-IIS/7.5 X-Powered-By:ServiceStack/3.926 Win32NT/.NET X-AspNet-版本:4.0.30319 X-Powered-By: ASP.NET 日期:2012 年 11 月 19 日星期一 23:15:46 GMT 内容长度:1528 未找到请求的处理程序: Request.ApplicationPath: /MyWebApp.Web.UI Request.CurrentExecutionFilePath:/MyWebApp.Web.UI/services/echo/ Request.FilePath:/MyWebApp.Web.UI/services/echo/ 请求.HttpMethod: GET Request.MapPath('~'): D:\Lib\MyWebApp\2013\MyWebApp\MyWebApp.Web.UI 请求路径:/MyWebApp.Web.UI/services/echo/ 请求路径信息: 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.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:本地主机 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:真 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、人力资源、js、obj、属性、样式、_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 重写规则。