Configure web.config for IIS to host DataService with net.tcp
[This post is regarding ADO.Net Data Services 1.5 CTP2]
I'm doing some experiments with ADO.Net Data Services. I'd like to host my service with IIS and use net.tcp binding.
I have created the data service and have configured IIS and the web application to use net.tcp, but I can't figure out how to activate the service. My web.config looks like this:<system.serviceModel> <services> <service name="ServiceApp1.MyDataService"> <endpoint address="net.tcp://localhost:50002/ServiceApp1/MyDataService1.svc" binding="netTcpBinding" bindingConfiguration="" contract="System.Data.Services.IRequestHandler" /> </service> </services> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> </system.serviceModel> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Data.Services" publicKeyToken="b77a5c561934e089"/> <bindingRedirect oldVersion="1.0.0.0-3.5.0.0" newVersion="4.0.0.0"/> </dependentAssembly> </assemblyBinding> </runtime>
I keep receiving a ServiceActivationException like this:
Exception: System.ServiceModel.ServiceActivationException: The service '/ServiceApp1/MyDataService1.svc' cannot be activated due to an exception during compilation. The exception message is: The operation 'ProcessRequestForMessage' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.. ---> System.InvalidOperationException: The operation 'ProcessRequestForMessage' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.Could someone please provide a sample web.config which shows how to host a data service with IIS on net.tcp?
All Replies
- Hi,
I am not sure if the problem is with the protocol. That you are using. Can you please confirm if the service works fine over http? From your error message, it seems that the message and the data contracts are mixed. Check this forum thread out.
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/ac900bbf-7e9e-4bdd-91b0-5b2a8f46f647/ - Hi,
The ADO.NET Data Services server supports only the WebHttpBinding .
Is there a reason you want to use the net TCP binding ?
Phani Raj Astoria http://blogs.msdn.com/PhaniRaj


