问题描述
我WebApplication的项目中创建一个简单的WCF服务。
I've created a simple WCF service inside of WebApplication project.
[ServiceContract(Namespace = "http://my.domain.com/service")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MyService
{
[OperationContract]
public string PublishProfile(out string enrollmentId, string registrationCode)
{
enrollmentId = null;
return "Not supported";
}
建 - 一切都被编译成功
built - everything is compiled successfully
之后,我试着打开浏览器的服务,我得到了以下错误:
After that I've tried to open service in browser, I've got the following error:
运行合同的MyServicePublishProfile'指定一个'去'或'参考'参数。操作与出或不支持'裁判'的参数
难道我不能出参数?
什么是错在这里?
感谢
P.S。我使用VS2008 SP1,.NET 3.5
P.S. I use VS2008 SP1, .NET 3.5
推荐答案
在我的情况的问题是,在我与Visual Studio向导ASP.NET应用程序中创建默认的服务配置是一个服务类型。端点绑定是的WebHttpBinding。据我现在知道它是绑定REST服务,他们只是没有与out参数工作体能。对他们来说,出不支持的参数。而我真正需要的是一个basicHttpBinding的允许与out参数来工作。
The problem in my case was that default service configuration created in my ASP.NET application with Visual Studio wizard was a service type. Endpoint binding was "webHttpBinding". As far as I understand now it is binding for REST services, and they just don't have physical ability to work with out parameters. For them out parameter is not supported. And what I actually needed was a 'basicHttpBinding" that allows to work with out parameters.
非常感谢大家谁帮我弄清楚这一点。
Many thanks to everybody who helped me to figure out that.
这篇关于WCF:不支持与输出参数的操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!