1

I have created a WCF rest service with 3 methods, the problem is that two of the methods works fine on the visual studio development server, but the last one returns 404 (both when I try to consume the service with jquery, according to fiddler2, and when trying to access the method with a browser.

the service contract for the method that dosen't work looks like this:

 [OperationContract]
 [FaultContract(typeof(GeneralCalendarFault))]
 [FaultContract(typeof(ConfigurationFault))]
 [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/GeoLocationSearch/{controlIdentification}/{positionX}/{positionY}/{positionZ}/{radiusInMeters}/{maxNumberOfEventsToBeReturned}/{startFetchingFromIndex}")]
 GeoLocationSearch_Response GeoLocationSearch(string controlIdentification, string positionX, string positionY, string positionZ, string radiusInMeters, string maxNumberOfEventsToBeReturned, string startFetchingFromIndex);

the service contract for the two method that works looks like this:

[OperationContract]
[FaultContract(typeof(GeneralCalendarFault))]
[FaultContract(typeof(ConfigurationFault))]
[WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/AdressSearch/{controlIdentification}/{addressSearchString}/{maxNumberOfEventsToBeReturned}/{startFetchingFromIndex}")] 
AddressSearch_Response AdressSearch(string controlIdentification, string addressSearchString, string maxNumberOfEventsToBeReturned, string startFetchingFromIndex);

and

[OperationContract]
[FaultContract(typeof(GeneralCalendarFault))]
[FaultContract(typeof(ConfigurationFault))]
[WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/GetAddressSuggest/{controlIdentification}/{search}/{maxNumberOfSuggestsToBeReturned}")]
GetAddressSuggest_Response GetAddressSuggest(string controlIdentification, string search, string maxNumberOfSuggestsToBeReturned);

the endpoint configuration looks like this:

<service name="Somenamespace.ServiceRest" behaviorConfiguration="Somenamespace.DevelopmentBehavior">
        <endpoint binding="webHttpBinding" address="json" contract="Somenamespace.IServiceRest" />
        <endpoint binding="mexHttpBinding" address="mex" contract="IMetadataExchange" />
      </service>

....

<webHttpBinding>
        <binding
          name="webHttpBinding"
          allowCookies="false"
          bypassProxyOnLocal="false"
          closeTimeout="00:10:00"
          hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="2147483647"
          maxBufferSize="2147483647"
          maxReceivedMessageSize="2147483647"
          openTimeout="00:10:00"

          receiveTimeout="00:10:00"
          sendTimeout="00:10:00"
          transferMode="Buffered"
          useDefaultWebProxy="true"
          >


            <security mode="None">
              <!--<transport clientCredentialType = "Windows"
                    proxyCredentialType="None"
                    realm="hei" />-->
            </security>
            <readerQuotas             
              maxArrayLength="2147483647"            
              maxBytesPerRead="2147483647"            
              maxDepth="2147483647"             
              maxNameTableCharCount="2147483647"                    
              maxStringContentLength="2147483647" />
        </binding>
        <!--proxyAddress="URI"
        writeEncoding="UTF8Encoding"
        -->
      </webHttpBinding>

I can't se anything that I do different with the GeoLocationSearch method that would make that method fail with a 404 not found, and the rest work perfectly.

anyhelp would be would be highly appreciated.

Edit: here is the http header for a request to a method that works:

GET http://localhost:52896/ServiceRest.svc/AdressSearch/11111111-1111-1111-1111-111111111111/Mikke%20Mus/10/0?_=1384292586745 HTTP/1.1
Host: localhost:52896
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost:59026/Front.aspx
Origin: http://localhost:59026
Connection: keep-alive

and here is the http header for a request to the GeoLocationSearch method that results in 404:

GET http://localhost:52896/ServiceRest.svc/GeoLocationSearch/11111111-1111-1111-1111-111111111111/11.495263000000001/64.015019/0/200/10/0?_=1384292586747 HTTP/1.1
Host: localhost:52896
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost:59026/Front.aspx
Origin: http://localhost:59026
Connection: keep-alive
  • in bottom text you typed "GeoLocationSerch" did you copy it from url by any chance? it's misspelled, would explain 404. – Konstantin Nov 12 '13 at 21:45
  • If you meen the line: "do different with the GeoLocationSerch", that was a grammatical error I made when typing out the question, didn't copy it from anywhere. – user2985085 Nov 12 '13 at 21:58
  • Isn't the case mentioned in http://stackoverflow.com/questions/8739312/webget-uritemplate-fails-on-dot-2e? You have dots in GeoLocationSearch url. – Konrad Kokosa Nov 12 '13 at 22:11
  • that seems to be the problem :D, removed the dots in the url and it works. thanks, I am really grateful for your answer. – user2985085 Nov 12 '13 at 22:27

0 Answers0