3 つのメソッドを使用して WCF レスト サービスを作成しました。問題は、メソッドのうちの 2 つが Visual Studio 開発サーバーで正常に動作することですが、最後のメソッドは 404 を返します (fiddler2 によると、両方とも jquery でサービスを使用しようとすると、ブラウザでメソッドにアクセスしようとしたとき。
機能しないメソッドのサービス コントラクトは次のようになります。
[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);
機能する 2 つのメソッドのサービス コントラクトは次のようになります。
[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);
と
[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);
エンドポイントの構成は次のようになります。
<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>
GeoLocationSearch メソッドを使用して、そのメソッドが 404 not found で失敗し、残りは完全に機能するという違いは何もわかりません。
どんな助けでも大歓迎です。
編集: 機能するメソッドへのリクエストの http ヘッダーは次のとおりです。
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
404 になる GeoLocationSearch メソッドへのリクエストの http ヘッダーは次のとおりです。
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