我在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";
}
Run Code Online (Sandbox Code Playgroud)
内置 - 一切都成功编译
之后我试图在浏览器中打开服务,我遇到以下错误:
合同"MyService"中的"PublishProfile"操作指定了"out"或"ref"参数.不支持使用"out"或"ref"参数的操作
我不能使用'out'参数吗?
这有什么不对?
谢谢
PS我使用VS2008 SP1,.NET 3.5
我的问题是,使用 Visual Studio 向导在 ASP.NET 应用程序中创建的默认服务配置是一种服务类型。端点绑定是“webHttpBinding”。据我现在了解,它与 REST 服务绑定,并且它们只是不具备在没有参数的情况下工作的物理能力。对于他们来说,out 参数不受支持。我真正需要的是一个“basicHttpBinding”,它允许使用外部参数。
非常感谢所有帮助我弄清楚这一点的人。
归档时间: |
|
查看次数: |
9248 次 |
最近记录: |