在IIS8上运行ServiceStack时出现404 Not Found错误 [英] 404 Not Found error when running ServiceStack on IIS8

查看:180
本文介绍了在IIS8上运行ServiceStack时出现404 Not Found错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ServiceStack Web服务在IIS Express(VS 2012)中以及在部署到Windows Azure时都能正常工作,但在Window 8的IIS 8下却无法正常工作.

My ServiceStack web service works fine in IIS Express (VS 2012) and when deployed to Windows Azure, but it does not work under IIS 8 on Window 8.

我正在获取404 Not Found Error.我的web.config具有为IIS Express和Web服务器定义的两个部分.

I am getting 404 Not Found Error. My web.config has both sections defined for IIS Express and the web server.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.web>
    <compilation debug="true" targetFramework="4.5">
      <assemblies>
        <add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
      <buildProviders>
        <add extension=".cshtml" type="ServiceStack.Razor.CSharpRazorBuildProvider, ServiceStack.Razor" />
      </buildProviders>
    </compilation>
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <system.webServer>
    <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>
</configuration>


解决方案:

只是通过进一步研究发现,这解决了我的问题:


Solution:

Just figured out, through further research, that this resolved my problem:

  1. 我将应用程序池切换为集成模式.
  2. 我在web.config中添加了以下内容:

  1. I switched the application pool to Integrated Mode.
  2. I added the following to web.config:

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true"/> 
</system.webServer>

推荐答案

重复该解决方案作为答案,以明确问题所在:

Repeating the solution as an answer, to make it clear what the issue was:

通过更多搜索,我发现了2条解决了我问题的建议:

by doing some more searching i found 2 suggestions that resolved my problem:

  1. 将应用程序池切换为集成模式
  2. 在web.config中添加了以下内容

  1. switched application pool to Integrated mode
  2. added the following to web.config

 <system.webServer>
<modules runAllManagedModulesForAllRequests="true"/> 

这篇关于在IIS8上运行ServiceStack时出现404 Not Found错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆