简体   繁体   中英

WCF Service. Can't host in IIS7

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM