I have a very simple hello world WCF service as given below. When i call it via asp.net project by adding web service reference it works perfectly fine. But when i called it using JQury or standard js ajax call (using XMLHttpRequest) it calls back the success function but returns null data.
When i tried to access it via firefox browser using this address "http://localhost:8282/Test/TestService.svc/HelloWorld"
it returned an error with code "a:ActionNotSupported" and error detail as "The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None)."
if i change binding to "wsHttpBinding" then it returns nothing even in the firefox browser
here is the code:
file "Test/ITestService.svc"
[ServiceContract(Namespace = "http://localhost:8282/")]
public interface ITestService
{
[OperationContract]
string HelloWorld();
}
file "Test/TestService.svc"
public class TestService : ITestService
{
public string HelloWorld()
{
return "This is echo from server. Hello World";
}
}
file "web.config"
"
<services>
<service name="radMLRPC.Test.TestService" behaviorConfiguration="radMLRPC.Test.TestServiceBehavior"
<endpoint address="HelloWorld" binding="webHttpBinding" contract="radMLRPC.Test.ITestService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="radMLRPC.Test.TestServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
"