WCF服务。无法在IIS7中托管

时间:2013-04-10 20:27:41

标签: c# wcf iis iis-7

我有一个非常简单的WCF服务,我试图在我的本地IIS中托管它。我一直都会收到这个错误:

HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

我尝试将应用程序池更改为Classic,但仍然无效。我尝试了很多其他网站但没有成功。

请有人帮忙吗。

更新1:

我在bin文件夹中有我的dll和pdb文件,我有这样的web.config:

<configuration>
    <system.web>
      <compilation debug="false" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
    </system.web>
  <system.serviceModel>
    <serviceHostingEnvironment>
      <serviceActivations>
        <add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="./HelloWorldService.svc" service="MyWCFServices.HelloWorldService" />
      </serviceActivations>
    </serviceHostingEnvironment>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

然后在IIS中添加了一个新项目,显示包含dll的文件夹的路径。 转到此链接时出现错误:http://mycomputername/HelloWorldService/HelloWorldService.svc.

更新2:

在我的计算机中,.NET 3.5.1功能已关闭。我把它打开了。然后我收到了这个错误:   enter image description here 然后我将Application pool中的.net版本更改为4.0.30319。在这些更改后仍然出现同样的错误:

HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

1 个答案:

答案 0 :(得分:1)

根据评论链:

在服务器级别的IIS,ISAPI和CGI限制中,您需要启用v4。

如果没有v4,则需要使用IIS安装/注册ASP.NET v4:

c:\windows\microsoft.net\framework\v4.0.30319\aspnet_regiis.exe -i