Sunday 5 April 2015

WCF .svc 404 not found

Once i had created a WCF web service in .net 3.5 it was working properly. After sometime we need to change .net version and some how with some reason i placed my application on new server. All was well but suddenly our .svc file was showing 404 resource not found. After doing some investigation what i found that HTTP Activation was not installed under WCF Services. I did it and all is working now.

Steps to install HTTP Activation

  • Run Server Manager (on task bar and start menu)
  • Choose the server to administer (probably local server)
  • Scroll down to "Roles and Features" section.
  • Choose "Add Role or Feature" from Tasks drop down
  • On "Add Role or Feature Wizard" dialog, click down to "Features" in list of pages on the left.
  • Expand ".Net 3.5" or ".Net 4.5", depending on what you have installed. (you can go back up to "roles" screen to add if you don't have.
  • Under "WCF Services", check the box for "HTTP-Activation". You can also add non-http types if you know you need them (tcp, named pipes, etc).
  • Click "Install" Button.




Now, Again i have some interesting experience, Upper given guide worked for me for next few project i was more happy then before because there was no more 404 for WCF. Again few days latter there was arequirenment to deploy those services with SSL. So we have to use https with URL. One i enabled ssl it gave me again 404.

I guessed wcf service not working in https and yes there was few configutation problem. I shortout easly by enabling httpsGetEnabled="true" in serviceMetadata with Security mode Transport.


       

<bindings>
  <basichttpbinding>
    <binding name="https">
      <security mode="Transport">
    </security></binding>
  </basichttpbinding>
</bindings>
<behaviors>
  <servicebehaviors>
    <behavior name="metadata">
      <servicemetadata httpsgetenabled="true">  
    </servicemetadata></behavior>
  </servicebehaviors>
</behaviors>
<services>
  <service behaviorconfiguration="metadata" name="...">
    <endpoint address="..." binding="basicHttpBinding" bindingconfiguration="https" contract="...">
  </endpoint></service>
</services>