나는 WCF의 ws2007HttpBinding 서비스에서 데이터를 얻기 위해 노력하고 있지만 다음과 같은 오류마다 점점 오전 :WCF 오류가 나는 그것을 실행 호출 Ws2007HttpBinding
The remote server returned an error: (415) Cannot process the message because
the content type 'application/soap+xml; charset=utf-8' was not the expected
type 'text/xml; charset=utf-8'..
:
는Content Type application/soap+xml; charset=utf-8 was not supported by service
http://localhost/GoldInSacks.MutualFunds.local/MutualFunds.svc. The client
and service bindings may be mismatched.
의 InnerException이 읽고 web.config의 system.ServiceModel 섹션은 다음과 같습니다.
<system.serviceModel>
<services>
<service name="GoldInSacks.MutualFunds">
<endpoint address=""
binding="ws2007HttpBinding"
contract="GoldInSacks.MutualFunds.Local.IMutualFunds" />
</service>
</services>
<bindings>
<ws2007HttpBinding>
<binding>
<security mode="None" />
</binding>
</ws2007HttpBinding>
</bindings>
</system.serviceModel>
클라이언트 코드 whi 채널은 현재 콘솔 응용 프로그램에서 실행되는 것은 다음과 같습니다
EndpointAddress address =
new EndpointAddress("http://localhost/MutualFunds.local/MutualFunds.svc");
var binding = new WS2007HttpBinding();
binding.Security.Mode = SecurityMode.None;
ChannelFactory<IMutualFundsChannel> channelFactory =
new ChannelFactory<IMutualFundsChannel>(binding, address);
IMutualFundsChannel channel = channelFactory.CreateChannel();
var mf = channel.GetMutualFundsByCustomer(1);
channel.Close();
foreach (var m in mf)
{
System.Console.WriteLine(m.Name);
}
System.Console.ReadLine();
오류가 GetMutualFundsByCustomer에 대한 호출에 발생합니다.
나는 wsHttpBinding도 시도했지만 동일한 오류가 발생했습니다.
누구나이 작업을 수행하는 방법을 알고 있습니까?
(이 질문의 간결함에 사과 하긴하지만 늦었고 잠이 필요합니다.)
어떻게 클라이언트의 web.config 파일 모양을합니까? – Jocke
@Jocke app.config는 클라이언트에서 비어 있습니다. 나는 코드 –
에서 완전히 이것을하고있다. 어쩌면 당신은 잘못된 종단점으로 보낼 것이다. 또한 wsdl을 열어 서비스가 실제로 soap12 (application/soap + xml을 의미 함)를 사용한다는 것을 정의하는지 확인합니다. –