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 modified httpGetEnabled to httpsGetEnabled in the below code in web.config and it resolved the issue.
<behaviors>
<serviceBehaviors>
<behavior name="DemoApp.Web.ChartsServiceBehavior">
<serviceMetadata httpsGetEnabled="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>
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?
Check this: https://social.msdn.microsoft.com/Forums/vstudio/en-US/2fd858cb-8988-444f-868c-2ceea9cc9705/httpgetenabled-property?forum=wcf
I ran into this problem today but none of the above solutions worked for me. I got it solved by doing the below.
Check what type of "ServiceHost" you are trying to open. For ex:
..
myServiceHost = new ServiceHost(typeof(CMDataCollector.CMDataService));
myServiceHost.Open(); //this line was giving the above exception
..
The type of "ServiceHost" should be the service name in your config as shown below.
<service name="CMDataCollector.CMDataService">
<endpoint address="rest" binding="webHttpBinding" contract="CMDataCollector.IRealtimeDataService" behaviorConfiguration="jsonBehavior" />
<endpoint address="" binding="basicHttpBinding" contract="CMDataCollector.IRealtimeDataService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:9080/TRealtimeData/" />
</baseAddresses>
</host>
</service>
The type of "ServiceHost" and the service name in the config should be same. Then you can open the "ServiceHost" and start the service