WCF服务。无法在IIS7中托管 [英] WCF Service. Can't host in IIS7

查看:137
本文介绍了WCF服务。无法在IIS7中托管的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a very simple WCF service and I am trying to host it in my local IIS. I get this error all the time:

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

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

I tried to change Application Pool to Classic, but still doesn't work. I tried bunch of other web sites but no success.

请有人帮忙。

更新1:

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

I have my dll and pdb file in the bin folder and I have web.config like this:

<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。

Then added a new project in IIS showing the path to the folder which contains dll. I get error when go to this link: http://mycomputername/HelloWorldService/HelloWorldService.svc.

更新2:

在我的计算机中,.NET 3.5.1功能已关闭。我把它打开了。然后我收到了这个错误:

然后我更改了.net版本在应用程序池中到4.0.30319。在这些更改后仍然出现相同的错误:

In my computer .NET 3.5.1 feature was turned off. I turned it on. Then I got this error: then I changed .net versions in Application pool to 4.0.30319. After these changes still same error:

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


推荐答案

根据评论链:

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

In IIS at the server level, ISAPI and CGI Restrictions, you'll need to enable v4.

如果v4不存在,您需要使用IIS安装/注册ASP.NET v4:

If v4 isn't there, you'll need to install/register ASP.NET v4 with IIS:

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

这篇关于WCF服务。无法在IIS7中托管的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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