简体   繁体   中英

Loading WCF Service from different folder in WCF Windows host

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>

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'.

Thanks in Advance, Nizam

Assuming XXX in your code sample is the fully qualified namespace to the service implementation, then here are some suggestions:

  • A dependency of WCFService.dll is not present in the same directory as the exe or the GAC.
  • You are producing a signed version of the host.exe which is trying to load an unsigned version of WCFService.dll
  • ???

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM