locked
Http 400 "Endpoint not found" RRS feed

  • Question

  • User-1907931422 posted

    I have an Ajax call.

    <script lang="javascript" type="text/javascript">
        function ttsFunction() {
            serviceUrl = "http://localhost:59899/wscccService.svc/RunTts";
            var data = new Object();
            data.text = $('#speak').val();
            var jsonString = JSON.stringify(data);
            $.ajax({
                type: 'POST',
                url: serviceUrl,
                data: jsonString,
                contentType: 'application/json; charset=utf-8',
                dataType: 'json',
    
                error: function (xhr,status,error) {
                    console.log("Status: " + status);
                    console.log("Error: " + error);
                    console.log("xhr: " + xhr.readyState);
                },
                statusCode: {
                    404: function() {
                        console.log('page not found');
                    }
                }
            });
        }
    </script>

    web.config file

    <?xml version="1.0"?>
    <configuration>
      <system.web>
        <compilation debug="true" targetFramework="4.5"/>
        <httpRuntime targetFramework="4.5"/>
        <customErrors mode="Off"></customErrors>
      </system.web>
      <system.serviceModel>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true">
          <serviceActivations>
            <add factory="System.ServiceModel.Activation.WebServiceHostFactory"
             relativeAddress="wscccService.svc"
             service="service.wservice"/>
          </serviceActivations>
        </serviceHostingEnvironment>
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <serviceMetadata httpGetEnabled="true"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
       </system.serviceModel>
    
      <system.webServer>
        <asp scriptErrorSentToBrowser="true"/>
        <httpErrors errorMode="Detailed"/>
      </system.webServer>
    </configuration>
    


    The service code:

    namespace service
    {
       [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
       [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
       public class wservice:Iwservice
       {
          public string RunTts(string value)
          {
              return "";
          }
       }
      }

    The interface code:

    namespace service
    {
       [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
       [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
       public class wservice:Iwservice
       {
          public string RunTts(string value)
          {
              return "";
          }
       }
      }


    When I typed the address to test the service on the hosting server.

    http://www.mydemosite.net/wscccService.svc

    in the browser, it has the error "Endpoint not found". I used file-less so there is no wscccService.svc existing. Is it a bug of wcf 4.0?


    Thanks for help.

     

     

    Wednesday, July 10, 2013 9:38 AM

All replies