I have windows 8.1 x64, Visual Studio 2012 x86, IIS 8.5.
I have a Wcf Service Host project (contains an svc file)
<%@ ServiceHost Language="C#" Debug="true" Service="WcfServiceImplementation.MyService" %>
I have a Wcf service implementation project.
Wcf hosted in IIS
I have 2 assemblies: WcfService.Host.dll and WcfServiceImplementation.dll
This code in WcfServiceImplementation.dll:
1)
Assembly.GetEntryAssembly()
gets the value null.
2)
Assembly.GetExecutingAssembly()
Gets a WcfServiceImplementation.
3)
Assembly.GetCallingAssembly()
gets System.ServiceModel.
How can I automatically set the location of the Service.Host assembly in the code that runs the WcfServiceImplementation assembly?
In general, for any Wcf service or web application, how to get the "main assembly" (wcf service host, web application)?
My trace (log):
ProcessName: w3wp
Is64BitOperatingSystem: True
Is64BitProcess: True
SystemConfigurationFile: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config
ConfigurationFile: C:\TFS\Tests\WcfService\web.config
MainModule.FileName: c:\windows\system32\inetsrv\w3wp.exe
MainModule.ModuleName: w3wp.exe
BaseDirectory: C:\TFS\Tests\WcfService\
ApplicationBase: C:\TFS\Tests\WcfService\
FriendlyName: /LM/W3SVC/2/ROOT-5-130404032112324911
ApplicationName: c36153ea
Code in WcfServiceImplementation assembly:
Assembly.GetEntryAssembly():
GetAssemblyExtendedData. Assembly null
Assembly.GetExecutingAssembly():
Location: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\2090c609\c36153ea\assembly\dl3\92d3ec19\b0fa1582_c649cf01\WcfServiceImplementation.dll
ProcessorArchitecture: MSIL
Assembly.GetCallingAssembly():
Location: C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll
ProcessorArchitecture: MSIL
Suggestions?