WCF Service. Can't host in IIS7

纵饮孤独 提交于 2019-12-24 09:26:05

问题


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.

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

Can anyone help on this please.

UPDATE 1:

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>

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.

UPDATE 2:

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.

回答1:


Per the comment chain:

In IIS at the server level, ISAPI and CGI Restrictions, you'll need to enable 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


来源:https://stackoverflow.com/questions/15935760/wcf-service-cant-host-in-iis7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!