gpt4 book ai didi

.net - WCF:不支持没有参数的操作

转载 作者:行者123 更新时间:2023-12-04 12:00:23 26 4
gpt4 key购买 nike

我在 WebApplication 项目中创建了一个简单的 WCF 服务。

[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 - 一切都编译成功

之后我尝试在浏览器中打开服务,出现以下错误:

Operation 'PublishProfile' in contract 'MyService' specifies an 'out' or 'ref' parameter. Operations with 'out' or 'ref' parameters are not supported



我不能使用'out'参数吗?

这里有什么问题?

谢谢

附言我使用 VS2008 SP1、.NET 3.5

最佳答案

我的问题是在我的 ASP.NET 应用程序中使用 Visual Studio 向导创建的默认服务配置是一种服务类型。端点绑定(bind)是“webHttpBinding”。据我现在了解,它与 REST 服务绑定(bind),它们只是没有物理能力来处理参数。对于他们来说,不支持 out 参数。而我真正需要的是一个允许使用 out 参数的“basicHttpBinding”。

非常感谢所有帮助我弄清楚这一点的人。

关于.net - WCF:不支持没有参数的操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4630627/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com