我需要通过一个自定义构造函数将一个字符串作为参数传递给WCF服务。
public partial class ServiceXX : IServiceXX
{
private string test;
static ServiceXX()
{
}
public ServiceXX()
{
this.test= null;
}
public ServiceXX(string test)
{
this.test= test;
}
}
我希望能够通过客户端中的服务引用(代理)来访问这个带参数的构造函数。
Asp.net示例:
using (ServiceXXClient proxy = new ServiceXXClient("Teste"))
{
}
有什么建议吗?
发布于 2013-06-22 03:20:58
你就是做不到。客户对你的服务代码不感兴趣。它只关心端点(abc - address、binding、contract)。请记住,您不是在调用代码,而是通过网络(或进程之间)发送一条消息,该消息将被接收并转换为使用您的代码。
client - call service (via through code friendly proxy)
- create message
- serialise
- send
service - receive message
- validate/verify
- deserialise
- authenticate/authorise
- call friendly code with friendly content
https://stackoverflow.com/questions/17242689
复制相似问题