Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The HttpGetEnabled property of ServiceMetadataBehavior is set to true and the HttpGetUrl property is a relative address, but there is no http baseadd

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?

like image 858
santosh kumar patro Avatar asked Jun 20 '14 10:06

santosh kumar patro


1 Answers

Either supply an HTTP base address or set HttpsGetUrl to an absolute address.

This error happened because the setting is logically wrong. If you enable the httpGetEnabled means, you allow clients to retrieve metadata via HTTP(means clients can get information about those methods services provided). And if you don't provide a URL for HTTP, how can clients retrieve metadata from HTTP. So the error message alert you to provide a URL.

You have three options.

  1. Provide httpGetUrl as the other answer showed above
  2. Binding an address via IIS

Bindings enter image description here

  1. Set httpGetEnabled to false or some answer modify httpGetEnabled to httpsGetEnabled means they only have HTTPS bindings setting on their IIS

like image 50
Sungfu Chiu Avatar answered Sep 25 '22 07:09

Sungfu Chiu