I have a ADFS enabled asp.net mvc2 application and is configured with HTTPS binding (Port No:443) in the IIS. The site is configured as DefaultWebSite in the IIS .I have a WCF service: ChartsService.svc within the asp.net mvc2 project which is used for a silverlight project present in the same solution. After complete testing in the local development environment, I have deployed the code to higher environments. It worked without any issues in all the environments. All of sudden in Staging server when I tried to smoke the silverlight project, I am getting a WCF error as mentioned below:
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.
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)
The Staging webserver is using IIS7.0. Currently I have following configuration in the 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>
what surprises me that it is still working fine in all higher environment except in Staging with the same configuration as mentioned above.
Can anyone help me to resolve this issue?
The answer above is one solution and here is another.
Try this:
<serviceBehaviors>
<behavior name="VATScan.Web.ChartsServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl="[your service address]" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
Replace [your service address] with something like "http://localhost:8080/ChartsServiceBehavior"
Did it do the trick?