Hello,
I have an existing ASP.NET web application. This ASP.NET web application uses JQuery to provide a rich experience to the users. This user interface interacts with the server through some WCF services. A sample service looks like the following:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
[ServiceBehavior(IncludeExceptionDetailInFaults = false)]
public class myService : ImyService
{
public bool SomeMethod(string parameter1, string parameter2)
{
try
{
return true;
}
catch (Exception ex)
{
return false;
}
}
}
I now want to expose this service to an iPhone and a Windows Phone 7 application. In an attempt to do this, I have configured the service like the following:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="myServiceBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="myService">
<endpoint address="" behaviorConfiguration="myServiceBehavior"
binding="webHttpBinding" contract="ImyService" />
</service>
</services>
</system.serviceModel>
The service works with the JQuery calls in my ASP.NET web application. I have not begun working on the iPhone client. But, when I try to expose this service to my WP7 client, I run into problems. As it stands now, when I launch my WP7 application, I receive an error that says:
KeyNotFoundException
If I change the binding in the config file to "basicHttpBinding", I cannot reference the service in Visual Studio. I receive an error that says:
The endpoint at 'http://machine:80/services/myService.svc' does not have a Binding with the None MessageVersion. 'System.ServiceModel.Description.WebScriptEnablingBehavior' is only intended for use with WebHttpBinding or similar bindings.
Ugh. How do I move forward? I thought WCF was designed to make this stuff easier. But I feel like I'm getting stuck doing something relatively basic.
Thank you for your help!