IIS 호스팅 WCF 웹 서비스가 있습니다. 그것은 두 명의 소비자로 시작되었습니다.WCF 끝점입니다. 여러 클라이언트
1) IDE에서 WCF 계약을 테스트하는 동일한 솔루션의 WinForm 테스트 도구.
2) 게시 된 버전을 사용하는 Asp.Net 웹 응용 프로그램.
모두 말하는 것처럼 상자에서 작동했습니다.
3 번째 소비자 인 Android 앱이 출시되었습니다. 이 작업을 올바르게 수행하려면 JSON WebGets 및 Webinvokes를 사용하여 WCF 계약을 장식하고 WCF Web.config를 변경해야합니다.
이제 원래의 두 소비자는 더 이상 작동하지 않습니다. 따라서 Web.config 및/또는 App.configs를 변경하여 세 가지 모두 작동하는 구성을 가져와야합니다.
먼저 IDE에 초점을 맞 춥니 다. WCF 서비스 Web.Config에 대한 다음 서비스 모델 섹션이 있습니다.
<system.serviceModel>
<client>
<endpoint binding="webHttpBinding" bindingConfiguration="JsonBinding"
contract="CouponParkingWCF.ICouponService" name="Json"
kind="" endpointConfiguration="">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="http://localhost:8707/CouponParking.svc"
binding="basicHttpBinding" contract="CouponParkingWCF.ICouponService"
name="BasicHttpBinding_ICouponService" />
</client>
<bindings>
<basicHttpBinding>
<binding name="basicHttp" />
</basicHttpBinding>
<webHttpBinding>
<binding name="JsonBinding" />
</webHttpBinding>
</bindings>
<services>
<service name="CouponParkingWCF.CouponService">
<endpoint behaviorConfiguration="JsonBehavior" binding="webHttpBinding"
bindingConfiguration="" name="jsonEndPoint"
contract="CouponParkingWCF.ICouponService" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="JsonBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="false" />
</system.serviceModel>
의 WinForm 테스트 하네스의 App.config이 있습니다
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttp" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8707/CouponParking.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttp"
contract="CouponParking.ICouponService"
name="BasicHttpBinding_ICouponService" />
</client>
</system.serviceModel>
내가 구성 엔드 포인트에서 경험하지 오전 위의 예와 추측에 근거되었습니다. 내가 테스트 장치를 실행하면
WCF 클라이언트의 인스턴스 만 계약에 대한 호출이 실패합니다
이There was no endpoint listening at http://localhost:8707/CouponParking.svc
that could accept the message. This is often caused by an incorrect address
or SOAP action. See InnerException, if present, for more details."
내부 예외는 다음과 같습니다
{"The remote server returned an error: (404) Not Found."}
[System.Net.WebException]: {"The remote server returned an error: (404) Not Found."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
HResult: -2146233079
InnerException: null
Message: "The remote server returned an error: (404) Not Found."
Source: "System"
StackTrace: " at System.Net.HttpWebRequest.GetResponse()\r\n at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)"
TargetSite: {System.Net.WebResponse GetResponse()}
나는에 대한 몇 가지 지침을 부탁드립니다 내가 틀렸어.
감사
눈에서
동일한 서비스를 다른 엔드 포인트 (예 : 바인딩이 다른 여러 클라이언트)에 동일한 엔드 포인트에서 표시하려고합니까? 그렇다면 그렇게 할 수 없습니다. 서로 다른 서비스 구현을 위해 다른 끝점을 노출해야합니다. – Tim
또한 세 번째 클라이언트를 추가하기 전에 * 구성 파일을 게시 할 수 있습니까? 그것이 작동 할 때의 모습과 현재의 모습 (작동하지 않을 때)을 확인하는 데 도움이 될 수 있습니다. – Tim
각 서버 측 끝점에는 ** 정의 된 바인딩이 하나 ** ** 있습니다. ** 첫 번째와 두 번째 클라이언트를위한'basicHttpBinding' (SOAP)을 지원하는 하나의 엔드 포인트를 가질 수없고, 동시에 안드로이드 클라이언트를위한'webHttpBinding' (REST)도 지원할 수 없다. ** 두 개의 별도 엔드 포인트 **를 사용해야합니다. –