应用程序中的服务器错误 - 尝试访问 WCF 服务时
我有一个 WCF 服务,我想将其托管在 IIS 7.5 中。我的设置: .svc 文件所在文件夹的物理路径为:C:\inetpub\wwwroot\SmartSolution\Services\Services\ContainerManagementService.svc 我的二进制文件位于 C:\inetpub\wwwroot\SmartSolution\Services\bin 中,我还将它们复制到 C:\inetpub\wwwroot\SmartSolution\Services\Services\bin
我已在 IIS 中为两个 Services 文件夹创建了一个 Web 应用程序。
这是 WCF 端点的配置文件:
<service behaviorConfiguration="MyNamespace.ContainerManagementServiceBehavior"
name="MyNamespace.ContainerManagementService">
<endpoint address="" binding="basicHttpBinding"
name="ContainerManagementbasicHttpEndpoint" contract="MyNamespace.IContainer"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<behaviors>
<behavior name="MyNamespace.ContainerManagementServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</behaviors>
这是我的 .svc 文件 makrkup:
<%@ ServiceHost Language="C#" Debug="true" Service="MyNamespace.ContainerManagementService" CodeBehind="ContainerManagementService.svc.cs" %>
当我尝试导航到: http://localhost/SmartSolution/Services/Services/ContainerManagementService.svc ,显示以下错误:
服务器错误 '/SMARTSOLUTION/服务/服务' 应用。 [服务激活异常: 服务 '/SMARTSOLUTION/服务/服务/ContainerManagementService.svc' 由于以下原因无法激活 编译过程中出现异常。这 异常消息是:不是有效的 Win32 应用程序。 (例外情况来自 HRESULT: 0x800700C1).] 不是有效的 Win32 应用程序。 (例外情况来自 HRESULT:0x800700C1)
我怎样才能让服务正常工作。谢谢!
I have a WCF service that I would like to host in IIS 7.5. My setup:
The physical path of the folder with .svc file is: C:\inetpub\wwwroot\SmartSolution\Services\Services\ContainerManagementService.svc
My binaries are in C:\inetpub\wwwroot\SmartSolution\Services\bin and I also copied them to
C:\inetpub\wwwroot\SmartSolution\Services\Services\bin
I have created a web application in IIS for both Services folders.
Here is the config file for the WCF endpoint:
<service behaviorConfiguration="MyNamespace.ContainerManagementServiceBehavior"
name="MyNamespace.ContainerManagementService">
<endpoint address="" binding="basicHttpBinding"
name="ContainerManagementbasicHttpEndpoint" contract="MyNamespace.IContainer"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<behaviors>
<behavior name="MyNamespace.ContainerManagementServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</behaviors>
Here is my .svc file makrkup:
<%@ ServiceHost Language="C#" Debug="true" Service="MyNamespace.ContainerManagementService" CodeBehind="ContainerManagementService.svc.cs" %>
When I try to navigate to: http://localhost/SmartSolution/Services/Services/ContainerManagementService.svc , the following error is displayed:
Server Error in
'/SMARTSOLUTION/Services/Services'
Application.
[ServiceActivationException: The
service
'/SMARTSOLUTION/Services/Services/ContainerManagementService.svc'
cannot be activated due to an
exception during compilation. The
exception message is: is not a valid
Win32 application. (Exception from
HRESULT: 0x800700C1).] is not a valid
Win32 application. (Exception from
HRESULT: 0x800700C1)
How can I get the service to work. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看例外情况,您的程序集(在 bin 文件夹中)似乎是针对 x64 平台构建的,它们现在要么部署在 32 位计算机上,要么为应用程序配置的应用程序池在 32 位模式下运行(启用 32 位应用程序 =“true”) )。因此,进程无法加载为 x64 平台构建的程序集,并且会出现异常失败。
华泰
阿米特
Looking at the exceptions, it seems that your assemblies (in bin folder) are built targeting x64 Plaform and they're now either deployed on 32bit machine or application pool configured for application is running under 32bit mode (Enable 32 bit Applications = "true"). Thus, process is unable to load the assemblies built for x64 platform and fails with exception.
HTH
Amit