WCF 서비스 및 Windows Phone 연결에 문제가 있습니다. 소스 코드가없는 서비스가 있습니다 (웹에서만 게시). Windows Phone 7 App에서 사용해야합니다.Windows Phone 7의 WCF 서비스
나는 프로젝트에 서비스 참조, VS 날 ServiceReferences.ClientConfig 파일 생성 추가
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="HttpBinding_IWcfMobilServices">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://www.www.com/WcfMobilServices.svc"
binding="basicHttpBinding" bindingConfiguration="HttpBinding_IWcfMobilServices"
contract="MobileService.IWcfMobilServices" name="HttpBinding_IWcfMobilServices"></endpoint>
</client>
</system.serviceModel>
</configuration>
내가 서비스 메소드를 호출
는 : LoginCompleted에public static void Login()
{
var proxy = new MobileService.WcfMobilServicesClient();
proxy.LoginAsync("loginName", "paswword");
proxy.LoginCompleted += (s, a) =>
{
//some code
};
}
응용 프로그램은에 나에게 예외를 throw합니다. 결과 :
System.ServiceModel.ProtocolException: Content Type text/xml; charset=utf-8 was not supported by service http://www.www.com/WcfMobilServices.svc . The client and service bindings may be mismatched. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.ClientHttpWebRequest.<>c_DisplayClasse.b_d(Object sendState) at System.Net.Browser.AsyncHelper.<>c_DisplayClass1.b_0(Object sendState) --- End of inner exception stack trace --- at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state) at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result) --- End of inner exception stack trace --- at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at W7App.MobileService.LoginCompletedEventArgs.get_Result()} System.ServiceModel.CommunicationException {System.ServiceModel.ProtocolException}
어떤 생각이 잘못된가요?
내가있는 wsHttpBinding에 설정 파일의 바인딩을 변경하려고했으나 VS 나에게 경고를 보여줍니다The element 'bindings' has invalid child element 'wsHttpBinding'. List of Possible elements expected: 'basicHttpBinding, CustomBinding'.
덕분에 우리의 대화에 이어
경고가 계속되면 어떻게됩니까? 이것은 가능한 복제 일 수 있습니다 : http://stackoverflow.com/questions/8250251/wcf-content-type-text-xml-charset-utf-8-was-not-supported-by-service – cvraman
경고를 무시하면 구성에서 응용 프로그램이 wcf 클래스의 인스턴스를 만드는 동안 오류가 발생했습니다 : 서비스 참조 구성에서 인식 할 수없는 요소 'wsHttpBinding'. Silverlight에서는 Windows Communication Foundation 구성 기능의 하위 집합 만 사용할 수 있습니다. – Davecz
Silverlight/WP7은 불행히도 기본 HTTP 만 지원합니다. 연결하려고하는 엔드 포인트가 기본 HTTP 바인딩을 지원하는지 알고 있습니까? 그것은 그렇지 않을 수도 있습니다? – Belogix