WCF 创建工厂类错误
public static T CreateServiceByUrl<T>(string bing)
{
try
{
if (string.IsNullOrEmpty(url)) throw new NotSupportedException("This url is not Null or Empty!");
EndpointAddress address = new EndpointAddress(url);
Binding binding = CreateBinding(bing);
ChannelFactory<T> factory = new ChannelFactory<T>(binding, address);
return factory.CreateChannel();
}
catch (Exception ex)
{
throw new Exception("创建服务工厂出现异常.");
}
}
错误信息如下
未能加载文件或程序集“WS.FrameWork, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”或它的某一个依赖项。系统找不到指定的文件。
这里面WS.FrameWork是我的底层访问数据库封装的类库
IUserService iu= WcfServiceFactory.CreateServiceByUrl<IUserService>(); 这里是创建WCF的工厂类位置