0

I have a WCF service created with VS2013 on Win8. If I start the service via VS (localhost:port) I'm able to do GET response in json

but same service i am hosted on server (IIS7) then i get 404 Error

localhost URL : http://localhost:43596/abc.svc/LoginUser/abc/abc

Live URL: http://mywwebsite.com:80/abc.svc/LoginUser/abc/abc

Prabhakar
  • 55
  • 9

1 Answers1

1

In my opionio, there might something amiss with the hosting environment, try to enable WCF feature support in IIS.
enter image description here
enter image description here
Here is my service, wish it is useful to you.
IService1.cs

[ServiceContract]
public interface IService1
{

    [OperationContract]
    [WebGet]
    string GetData(int value);

Service1.svc.

public class Service1 : IService1
{
    public string GetData(int value)
    {
        return string.Format("You entered: {0}", value);
    }

Web.config

  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior>
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <webHttpBinding>
        <binding name="mybinding">
          <security mode="Transport">
            <transport clientCredentialType="None"></transport>
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <protocolMapping>
      <add binding="webHttpBinding" scheme="http"/>
      <add binding="webHttpBinding" scheme="https" bindingConfiguration="mybinding"/>
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

Since the above configuration support both http and https protocol, we need to add http and https binding in IIS site binding module.
enter image description here
enter image description here
Reference.
How to make WCF Service Use HTTPS protocol
Feel free to let me know if there is anything I can help with.

Abraham Qian
  • 7,117
  • 1
  • 8
  • 22