我在建WCF时,在具体实现服务时调用了其他dll里面的方法,现在我在客户端调用该服务,如何访问服务中调用的其他dll里面的属性或者变量?
具体代码如下: 类库:Contract
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Leon.BLL;
namespace Leon.WcfService
{
[ServiceContract(CallbackContract = typeof(ICallback))]
public interface IService
{
[OperationContract]
Leon.BLL.MessageInfo Run(Leon.BLL.StockEntity entity);
[OperationContract]
string Submit(string id);
} public interface ICallback
{
[OperationContract]
void ShowResult();
}
}
类库:Service
namespace Leon.WcfService
{
public class Service : IService
{
public Leon.BLL.MessageInfo Run(Leon.BLL.StockEntity entity)
{
return new Leon.BLL.MessageInfo();
} public string Submit(string id)
{
return "";
} }
} 还有一个是Hosting,就是启动宿主的,省去,,, 下面是客户端调用WCF服务代码:
1. 引用Contract的dll
2. 创建类ServiceCallback,继承ICallback
public class ServiceCallback: ICallback
{
......代码省去
}
3. aspx页面调用服务
protected void Button1_Click(object sender, EventArgs e)
{
ServiceCallback call = new ServiceCallback();
//调用WCF服务
DuplexChannelFactory <IService> channelFactory = new DuplexChannelFactory <ITransitionService>(new InstanceContext(call ), "Service");
IService wcf = channelFactory.CreateChannel();
下面的代码不知道怎么写下去??
wcf.Run(.....);
}
在上面的客户端调用代码中,我要用到Leon.BLL.MessageInfo跟Leon.BLL.StockEntity,但不知道从哪儿引入,请大家帮我看看?
具体代码如下: 类库:Contract
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Leon.BLL;
namespace Leon.WcfService
{
[ServiceContract(CallbackContract = typeof(ICallback))]
public interface IService
{
[OperationContract]
Leon.BLL.MessageInfo Run(Leon.BLL.StockEntity entity);
[OperationContract]
string Submit(string id);
} public interface ICallback
{
[OperationContract]
void ShowResult();
}
}
类库:Service
namespace Leon.WcfService
{
public class Service : IService
{
public Leon.BLL.MessageInfo Run(Leon.BLL.StockEntity entity)
{
return new Leon.BLL.MessageInfo();
} public string Submit(string id)
{
return "";
} }
} 还有一个是Hosting,就是启动宿主的,省去,,, 下面是客户端调用WCF服务代码:
1. 引用Contract的dll
2. 创建类ServiceCallback,继承ICallback
public class ServiceCallback: ICallback
{
......代码省去
}
3. aspx页面调用服务
protected void Button1_Click(object sender, EventArgs e)
{
ServiceCallback call = new ServiceCallback();
//调用WCF服务
DuplexChannelFactory <IService> channelFactory = new DuplexChannelFactory <ITransitionService>(new InstanceContext(call ), "Service");
IService wcf = channelFactory.CreateChannel();
下面的代码不知道怎么写下去??
wcf.Run(.....);
}
在上面的客户端调用代码中,我要用到Leon.BLL.MessageInfo跟Leon.BLL.StockEntity,但不知道从哪儿引入,请大家帮我看看?
解决方案 »
- .net Repeater1控件
- 动态生成button按钮问题
- 超超菜问题,怎么读html label的值
- 请教ASP.NET高手:外网网关转发http请求到内网以后,为什么ip地址变成了内网地址?
- RadioButtonList的SelectedIndexChanged事件中如何取当前选中项的值?急!!!
- 哪位大虾帮帮忙!Asp.net程序问题
- 动态的在table里加了一个textbox控件后,怎么把它的值取出来
- winxp 能装iis6吗?
- 系统utf-8编码格式,生成的静态页面是gb2312的,为什么静态页传的中文动态页码得不到呢
- 请问如何实现自动滚动字幕?
- DataList有2个ImageButton如何判断那个点击,根据点击的ImageButton跳转
- 后台实现类似超链接的效果
汗 楼主使用引用??
using Leon.BLL; 在什么地方使用就在什么地方加上就行了Leon.BLL.MessageInfo Leon.BLL.StockEntity