I am receiving the following error when trying to create an endpoint with the System.Data.Services.IRequestHandler contract
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.
I found two other questions with this error (here and
here), but neither of them had satisfactory solutions. I pulled the
Northwind example and was able to reproduce the problem.
I can get rid of the error by replacing the System.Data.Services.IRequestHandler contract with my own and removing the parameter that the error message is complaining about.
The built-in ServiceContract, which throws the error:
I'm confused about why the built-in ServiceContract is throwing this error when I try to use it in an endpoint. I'm fairly new to Data Services, so I'm sure I am missing something that seems obvious to everyone else.
At the end of the day my goal is to use Certificate Authentication, so if there is a way to do that while working around this problem I'm open to it. I've been using this
example.
According to your description, this issue is related to WCF data service, I will suggest you post the issue in
WCF Data Services forum, there are more professionals on this issue, so you can get better support.
Thanks for your understanding.
Best Regards.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
The answer ended up being to use webHttpBinding instead of basicHttpBinding or wsHttpBinding. Not sure why this works when the other ones don't, but it does.
Marked as answer by andreamc on Feb 05, 2013 05:53 PM
andreamc
0 Points
3 Posts
Data Services endpoint with System.Data.Services.IRequestHandler contract throws error
Nov 30, 2012 04:36 AM|LINK
I am receiving the following error when trying to create an endpoint with the System.Data.Services.IRequestHandler contract
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.
I found two other questions with this error (here and here), but neither of them had satisfactory solutions. I pulled the Northwind example and was able to reproduce the problem.
The simplified web.config file:
<configuration> <system.web> <compilation debug="true" targetFramework="4.0"> <assemblies> <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </assemblies> </compilation> </system.web> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> <system.serviceModel> <services> <service name="NorthwindService.Northwind"> <endpoint address="http://localhost:12345/Northwind.svc" binding="basicHttpBinding" contract="System.Data.Services.IRequestHandler" /> </service> </services> </system.serviceModel> </configuration>.svc file:
I can get rid of the error by replacing the System.Data.Services.IRequestHandler contract with my own and removing the parameter that the error message is complaining about.
The built-in ServiceContract, which throws the error:
namespace System.Data.Services { [ServiceContract] public interface IRequestHandler { [OperationContract] [WebInvoke(UriTemplate = "*", Method = "*")] Message ProcessRequestForMessage(Stream messageBody); } }My ServiceContract, which doesn't throw the error (but also doesn't really work since I didn't replicate all of the DataService<T> functionality):
namespace NorthwindService { [ServiceContract] interface Interface1 { [OperationContract] [WebInvoke(UriTemplate = "*", Method = "*")] Message ProcessRequestForMessage(); } }I'm confused about why the built-in ServiceContract is throwing this error when I try to use it in an endpoint. I'm fairly new to Data Services, so I'm sure I am missing something that seems obvious to everyone else.
At the end of the day my goal is to use Certificate Authentication, so if there is a way to do that while working around this problem I'm open to it. I've been using this example.
Thanks,
Andrea
Haixia Xie -...
Contributor
3087 Points
298 Posts
Microsoft
Re: Data Services endpoint with System.Data.Services.IRequestHandler contract throws error
Dec 04, 2012 06:36 AM|LINK
Hi andreamc,
According to your description, this issue is related to WCF data service, I will suggest you post the issue in WCF Data Services forum, there are more professionals on this issue, so you can get better support.
Thanks for your understanding.
Best Regards.
Feedback to us
Develop and promote your apps in Windows Store
andreamc
0 Points
3 Posts
Re: Data Services endpoint with System.Data.Services.IRequestHandler contract throws error
Dec 04, 2012 07:36 PM|LINK
Okay, thanks for the tip. I reposted here.
andreamc
0 Points
3 Posts
Re: Data Services endpoint with System.Data.Services.IRequestHandler contract throws error
Feb 05, 2013 05:53 PM|LINK
The answer ended up being to use webHttpBinding instead of basicHttpBinding or wsHttpBinding. Not sure why this works when the other ones don't, but it does.