从WCF Windows主机中的其他文件夹加载WCF服务 [英] Loading WCF Service from different folder in WCF Windows host

查看:46
本文介绍了从WCF Windows主机中的其他文件夹加载WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想从WCF Windows host.EXE文件加载WCF服务dll.但是WCf Service.dll存储在其他文件夹中.

文件夹结构:
\ @root \ Service \ WCFService.dll(这是服务)
\ @root \ Host \ WCFHost.exe(这是主机exe)
\ @root \ Host \ WCFHost.exe.config(这是主机exe配置)

Hi,

I want to load WCF service dll from WCF Windows host.EXE file. But WCf Service.dll is stored in some other folder.

Folder structure:
\@root\Service\WCFService.dll (this is service)
\@root\Host\WCFHost.exe (this is host exe)
\@root\Host\WCFHost.exe.config (this is host exe configuration)

<services>
      <service name="XXX.Service">
        <endpoint address="http" binding="basicHttpBinding" contract="XXX.IService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8035/Service" />
          </baseAddresses>
        </host>
      </service>
<services>



当我启动Windows服务时,出现以下错误:



When I start my windows service, I am getting the following error:

Service cannot be started. System.IO.FileNotFoundException: Could not load file or assembly 'XXX.Service, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'XXX.Service, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.


在此先感谢,
Nizam


Thanks in Advance,
Nizam

推荐答案

你好,

看一下这些链接.

http://msdn.microsoft.com/en-us/library/823z9h8w.aspx

http://kalpeshshirodker.wordpress .com/2007/09/06/specify-where-for-look-for-the-寻找引用的程序集在c-application/

您必须为AppDomain实现``AssemblyResolve''事件,或者必须指定.NET查找组件的所有目录(appconfig中的探测路径).

AssemblyResolve:
http://codinglight.blogspot.com/2009/07/assembly-resolution-with.html
Hello,

take a look at these links.

http://msdn.microsoft.com/en-us/library/823z9h8w.aspx

http://kalpeshshirodker.wordpress.com/2007/09/06/specify-where-to-look-for-referenced-assemblies-in-c-application/

Either you have to implement the ''AssemblyResolve'' event for your AppDomain or you have to specifiy all directories where .NET should look to find your assemblies (probing path in appconfig).

AssemblyResolve:
http://codinglight.blogspot.com/2009/07/assembly-resolution-with.html


这篇关于从WCF Windows主机中的其他文件夹加载WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆