【发布时间】:2014-08-21 15:36:43
【问题描述】:
我有 Windows 8.1 x64、Visual Studio 2012 x86、IIS 8.5。
我有 Wcf 服务主机项目(包含 svc 文件)
<%@ ServiceHost Language="C#" Debug="true" Service="WcfServiceImplementation.MyService" %>
我有 Wcf 服务实施项目。
IIS 中托管的 Wcf 服务
我有 2 个程序集:WcfService.Host.dll 和 WcfServiceImplementation.dll
WcfServiceImplementation.dll 中的这段代码:
1)
Assembly.GetEntryAssembly()
得到空值。
2)
Assembly.GetExecutingAssembly()
获取 WcfServiceImplementation。
3)
Assembly.GetCallingAssembly()
获取 System.ServiceModel。
如何在执行 WcfServiceImplementation 程序集的代码中以编程方式获取 Service.Host 程序集位置?
一般来说,对于任何 Wcf 服务或 Web 应用程序,如何获取“主程序集”(wcf 服务主机、Web 应用程序)?
我的踪迹(日志):
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
建议?
【问题讨论】:
标签: wcf .net-assembly servicehost