Olá a todos, estou fazendo um tutorial usando Jquery para se comunicar com um serviço WCF.
Tenho o seguinte cenário:
Uma solução com o serviço hospedado com um projeto Console, usando ServiceHost;
Uma solução com o Web site que conecta o serviço usando a função .ajax() do jquery-1.3.2;
O serviço foi configurado da seguinte forma:
<system.serviceModel>
<services>
<service name="ServiceManutencaoWCF.ServicoManutencao" behaviorConfiguration="BehaviorsManutencao">
<endpoint address="http://localhost/ServicoManutencao" binding="webHttpBinding" name="BehaviorsManutencao" contract="ServiceManutencaoWCF.IServiceManutencao" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="BehaviorsManutencao">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="BehaviorsManutencao">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
O seguinte contrato:
[ServiceContract]
public interface IServiceManutencao
{
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
CustomData GetProvinceAndBrowser(string Country, string Browser);
}
E a chamada é feita da seguinte forma
function CallService() {
$.ajax({
type: varType, //GET or POST or PUT or DELETE verb
url: varUrl, // Location of the service
data: varData, //Data sent to server
contentType: varContentType, // content type sent to server
dataType: varDataType, //Expected data format from server
processdata: varProcessData, //True or False
success: function(msg) {//On Successfull service call
ServiceSucceeded(msg);
},
error: ServiceFailed// When Service call fails
});
}
A mensagem de erro está abaixo:
"Sendera:DestinationUnreachableA mensagem com To 'http://localhost/ServicoManutencao/GetProvinceAndBrowser' não pode ser processada no destinatário, devido a um AddressFilter incorreto no EndpointDispatcher. Verifique se o EndpointAddresses
do remetente e do destinatário está de acordo.
É isso... ta meio complicado, mas quem souber a solução eu agradeço
Faloo Valeu
Sacanagem sem limite