Web服务.Net 4.0在IIS7中发布问题

时间:2013-01-28 17:59:32

标签: web-services c#-4.0 .net-4.0 iis-7.5 asmx

我无法发布我的Web服务,应该很简单:

  1. 我在IIS中创建了应用
  2. 将其设为4.0 Classic .Net
  3. 我在VS2012中从.Net解决方案发布它右键单击并发布 在Webservice项目上。
  4. 放置文件,它应该在浏览器上显示在指定服务器的URL上。

    但我偶然发现了以下问题:

    HTTP Error 404.17 - Not Found 
    The requested content appears to be script and will not be served by the static file handler.
    

    所以我找了它并找到了这两个选项:

    选项1:

    http://www.banmanpro.com/support2/Requested_Content_Appears_to_be_Script.asp

    这个说我应该去Integrated,而不是Classic App Pool。但是,如果我为另一个问题改变了问题,因为它现在说:

    HTTP Error 500.21 - Internal Server Error
    Handler "WebServiceHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list
    

    当我转到网络配置时,看到这个错误在谈论我看到没有处理程序标记!

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <appSettings />
      <connectionStrings />
      <system.web>
        <compilation targetFramework="4.0" />
        <!--
          The <authentication> section enables configuration 
          of the security authentication mode used by 
          ASP.NET to identify an incoming user. 
        -->
        <authentication mode="Windows" />
        <!--
           The <customErrors> section enables configuration 
           of what to do if/when an unhandled error occurs 
           during the execution of a request. Specifically, 
           it enables developers to configure html error pages 
           to be displayed in place of a error stack trace.
    
           <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
             <error statusCode="403" redirect="NoAccess.htm"/>
             <error statusCode="404" redirect="FileNotFound.htm"/>
           </customErrors>
        -->
        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
      </system.web>
        <system.webServer>
            <directoryBrowse enabled="true" />
        </system.webServer>
      <!-- 
            The system.webServer section is required for running ASP.NET AJAX under Internet
            Information Services 7.0.  It is not necessary for previous version of IIS.
        -->
    </configuration>
    

    我应该加一个吗?如果是这样,怎么样?

    选项2:

    Script not served by static file handler on IIS7.5

    基本上它说我应该做 aspnet_regiis -i ,但当我尝试

    转到%windir%\ Microsoft.NET \ Framework \ v4.0.30319

    即使文件夹存在,也没有aspnet_regiis !!

    我只在2.0 Fwk上找到 aspnet_regiis =(

    这是正常的吗?

1 个答案:

答案 0 :(得分:1)

处理程序标记不是答案,但是,这两个选项驱使我寻找fwk 4缺少的aspnet_regi。

没有aspnet_regiis,因为首先没有安装完整的fwk 4.0

我在服务器上安装了 Framework 4 Client Profile 和调试器,这不是完整版。从现在开始,每当我我安装了fwk 4时,我都会检查两次。

安装后,在Framework 4.0 Classic 管道模式(而不是集成)上使其工作正常。

但注意!

安装框架后,IIS会将默认管道更改为4.0 ,这意味着,如果您在2.0上进行了Web(站点/服务),它将自动停止工作。 (它发生在我身上)