【发布时间】:2014-06-20 10:35:16
【问题描述】:
我有一个启用 ADFS 的 asp.net mvc2 应用程序,并在 IIS 中配置了 HTTPS 绑定(端口号:443)。该站点在 IIS 中配置为 DefaultWebSite。我有一个 WCF 服务:asp.net mvc2 项目中的 ChartsService.svc,该项目用于同一解决方案中存在的 silverlight 项目。在本地开发环境完成测试后,我已经将代码部署到更高的环境。它在所有环境中都没有任何问题。 当我尝试使用 silverlight 项目时,在暂存服务器中突然出现 WCF 错误,如下所述:
System.InvalidOperationException ServiceMetadataBehavior的HttpGetEnabled属性设置为true,HttpGetUrl属性是相对地址,但是没有http基地址。要么提供一个 http 基地址,要么将 HttpGetUrl 设置为一个绝对地址。
System.ServiceModel.ServiceActivationException: The service '/ChartsService.svc' cannot be activated due to an exception during compilation. The exception message is: The HttpGetEnabled property of ServiceMetadataBehavior is set to true and the HttpGetUrl property is a relative address, but there is no http base address. Either supply an http base address or set HttpGetUrl to an absolute address.. ---> System.InvalidOperationException: The HttpGetEnabled property of ServiceMetadataBehavior is set to true and the HttpGetUrl property is a relative address, but there is no http base address. Either supply an http base address or set HttpGetUrl to an absolute address.
at System.ServiceModel.Description.ServiceMetadataBehavior.CreateHttpGetEndpoints(ServiceDescription description, ServiceHostBase host, ServiceMetadataExtension mex)
at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
at System.ServiceModel.ServiceHostBase.InitializeRuntime()
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)
Staging 网络服务器正在使用 IIS7.0。 目前我在 web.config 中有以下配置:
<behaviors>
<serviceBehaviors>
<behavior name="VATScan.Web.ChartsServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="DemoApp.Web.ChartsServiceBehavior" name="DemoApp.Web.ChartsService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="ServicesBinding" contract="DemoApp.Web.IChartsService" />
</service>
</services>
令我惊讶的是,它在所有更高的环境中仍然可以正常工作,除了在与上面提到的相同配置的 Staging 中。
谁能帮我解决这个问题?
【问题讨论】:
标签: wcf silverlight-5.0