안녕하세요. 안녕하세요. 안녕하세요. 저는 안녕하세요. 안녕하세요.WCF 용 서비스 모델 구성
은 IIS 7에서 배포하고 괜찮습니다,하지만 난 웹 서비스를 테스트하기 위해 CMD를 통해 svcutil.exe http://localhost:4569/Service.svc?wsdl
을 할 때 얻을 실행 :
the remote server returned an error: 415 cannot proccess the message because the content type 'aplication/soap+xml charset=utf8' was not the expected type 'text/xml charset=utf8'
(클라이언트를 만드는) 서비스 참조를 추가하려고
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="Service">
<endpoint name="soap"
address="http://localhost:4569/Service.svc"
binding="basicHttpBinding"
contract="IService" />
<endpoint name="mex" address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</services>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
: 난 내 Web.config 파일에서 문제가 있음을 확신
수An existing connection was forcibly closed by the remote host Metadata contains a reference that cannot be resolved: 'http://localhost:4569/Service.svc'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:4569/Service.svc . The client and service bindings may be mismatched. 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'..
IService.cs :
어쨌든, 여기 내 코드의
내 service.cs
[ServiceContract]
public interface IService
{
[OperationContract]
string getMessage();
}
는
public class Service : IService
{
public string getMessage()
{
return "Ola servico";
}
}
난 정말 무슨 일이 일어나고 있는지 모르는했던 방법이있다 약간의 연구 후 일부 테스트지만 성공하지 못합니다.
Service.svc
<%@ ServiceHost Language="C#" Debug="true" Service="Service" CodeBehind="~/App_Code/Service.cs" %>
설정의 ** 재미있는 ** (** 중요 **) 부분을 표시하지 않습니다! 서버 측의''에있는''섹션과 * .svc 파일의 내용! 그것들을 추가하십시오 - 그렇지 않으면 우리는 최고로 추측을 남겼습니다 ... –
은 전체 설정 파일입니까? 코드에 정의 된 서비스, 바인딩 및 끝점입니까? – MLT
오류 메시지는 SOAP 및 REST가 혼합되어 있음을 나타냅니다. WSDL을 가져오고 싶지만 REST 바인딩 ('webHttpBinding')을 사용하는 것처럼 보입니다. –