Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have hosted a wcf service in IIS ..and I browse service from IIS directly.
I got service is created, but when I browse from browser with [a link](http://localhost:55493/Service1.svc/MyFunction/apple)! I am getting Endpoint not found.

Interface
C#
[OperationContract]
[WebInvoke(Method = "*", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
string MyFunction(string Count);
    // TODO: Add your service operations here
}

Class
C#
[AspNetCompatibilityRequirements(RequirementsMode
= AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1
{
    public string MyFunction(string Count)
    {
        return "The Name you passed  is: " + Count.ToString();
    }
}

web.config
XML
<system.serviceModel>
      <services>
      <service name="WcfService3codepro.Service1" behaviorConfiguration="MyServiceBehaviour">
        <endpoint address="" binding="webHttpBinding" contract="WcfService3codepro.IService1" behaviorConfiguration="MyEndpointBehavior" />
      </service>
    </services>
    <bindings>

    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceBehaviour">
          <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>

    <endpointBehaviors>
        <behavior name="MyEndpointBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true" />
        <defaultDocument>
            <files>
                <add value="Service1.svc" />
            </files>
        </defaultDocument>
  </system.webServer>

</configuration>
Posted
v3

This problem is created due to [WebInvoke(Method = "*", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat

It is happening you are using ResponseFormat for WebInvoke
So it needs to change below format

XML
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json)]
[FaultContract(typeof(KenException))]
List<Data> GetAllData();  //Select time

[OperationContract]
[WebInvoke(RequestFormat = WebMessageFormat.Json)]
[FaultContract(typeof(KenException))]
DataInsertData(Data user);//Insert Time


Thanks
 
Share this answer
 
Comments
karthik mushyam 3-Nov-13 23:52pm    
After changing it to RequestFormat also a'm getting same thing endpoint not found
Change in Interface file (IService1.cs) with below line and test it again:
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "MyFunction/{value}")]


Hope it will help you!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900