none
Endpoint not found. Please see the service help page for constructing valid requests to the service while accessing wcf service RRS feed

  • Question

  • Hi,

     I have created a json acceptable wcf service and below is the web.config code.

    <?xml version="1.0"?>
    <configuration>

      <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
          <section name="RetrieveSharepointGroups.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        </sectionGroup>
      </configSections>
       <system.web>
        <compilation debug="true" targetFramework="4.0" />
      </system.web>
      <system.serviceModel>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false" />

        <services>
          <service behaviorConfiguration="WebServiceBehavior" name="RetrieveSharepointGroups.RetrieveSPGroupService">
            <endpoint address="json" behaviorConfiguration="jsonBehavior" binding="webHttpBinding"
              bindingConfiguration="webHttpBindingWithJsonP" contract="RetrieveSharepointGroups.RetrieveSPGroups" />
            <endpoint address="soap" binding="basicHttpBinding" contract="RetrieveSharepointGroups.RetrieveSPGroups" />
          </service>
        </services>

        <behaviors>
          <endpointBehaviors>
            <behavior name="jsonBehavior">
              <webHttp helpEnabled="true"/>
            </behavior>
          </endpointBehaviors>

          <serviceBehaviors>
            <behavior name="WebServiceBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>

        <bindings>
          <webHttpBinding>
            <binding name="webHttpBindingWithJsonP"
                     crossDomainScriptAccessEnabled="true" />
          </webHttpBinding>
        </bindings>
      </system.serviceModel>

      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
     </system.webServer>

    </configuration>

    service class method is

     public string Test(string id)
            {
                return "thriveni"+id;

            }

    operation contract is

     [OperationContract]       
            [WebInvoke(Method="POST", RequestFormat = WebMessageFormat.Json, ResponseFormat=WebMessageFormat.Json)]
             String Test(string id);

    but when am accessing wcf service with url http://localhost:53450/Service1.svc/json/11

    am getting

    Endpoint not found. Please see the service help page for constructing valid requests to the service.

    could anyone help on this why am getting this error.

    Thanks in advance.


    Monday, December 16, 2013 7:37 AM

Answers

  • Hi,

    I saw that you have used the following url: http://localhost:53450/Service1.svc/json/11 , but you do not use the UriTemplate, please try to change your OperationContract as following:

     [OperationContract]        
     [WebInvoke(Method="POST", RequestFormat = WebMessageFormat.Json, ResponseFormat=WebMessageFormat.Json,UriTemplate = "json/{id}")]
      String Test(string id);
    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 17, 2013 9:07 AM
    Moderator