1
votes

I failed to find any useful information on that matter so I write here:

I created a WCF service app that works fine in development but when I deploy it I get this error on the IIS (7.0):

The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the HttpsGetUrl property is a relative address, but there is no https base address. Either supply an https base address or set HttpsGetUrl to an absolute address.

App is .Net FW 4.0, IIS Application Pool is ASP.NET v4.0

web.config:

  <service name="ServiceName.Service1">
    <endpoint address=""
              behaviorConfiguration="restfulBehavior" 
              binding="webHttpBinding" 
              contract="ServiceName.IServiceApp"/>
  </service>

<serviceMetadata httpGetEnabled="true" 
                 httpGetUrl="http://localhost:10001/ServiceName"  
                 httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />

Hope someone can help with this.

Windows Event Log:
Log Name:      Application
Source:        System.ServiceModel 4.0.0.0
Date:          28.5.2014 0:11:19
Event ID:      3
Task Category: WebHost
Level:         Error
Keywords:      Classic
User:          IIS APPPOOL\ASP.NET v4.0
Computer:      Server.domain.local
Description:
WebHost failed to process a request.
 Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/3486411
 Exception: System.ServiceModel.ServiceActivationException: The service '/ServiceApp/ServiceName.svc' cannot be activated due to an exception during compilation.  The exception message is: The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the HttpsGetUrl property is a relative address, but there is no https base address.  Either supply an https base address or set HttpsGetUrl to an absolute address.. ---> System.InvalidOperationException: The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the HttpsGetUrl property is a relative address, but there is no https base address.  Either supply an https base address or set HttpsGetUrl to an absolute address.
   at System.ServiceModel.Description.ServiceMetadataBehavior.EnsureGetDispatcher(ServiceHostBase host, ServiceMetadataExtension mex, Uri url, String scheme)
   at System.ServiceModel.Description.ServiceMetadataBehavior.CreateHttpGetEndpoints(ServiceDescription description, ServiceHostBase host, ServiceMetadataExtension mex)
   at System.ServiceModel.Description.ServiceMetadataBehavior.ApplyBehavior(ServiceDescription description, ServiceHostBase host)
   at System.ServiceModel.Description.ServiceMetadataBehavior.System.ServiceModel.Description.IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase)
   at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
   at System.ServiceModel.ServiceHostBase.InitializeRuntime()
   at System.ServiceModel.ServiceHostBase.OnBeginOpen()
   at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
   --- End of inner exception stack trace ---
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
 Process Name: w3wp
 Process ID: 4520

Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="System.ServiceModel 4.0.0.0" />
    <EventID Qualifiers="49154">3</EventID>
    <Level>2</Level>
    <Task>5</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2014-05-27T22:11:19.000000000Z" />
    <EventRecordID>64475</EventRecordID>
    <Channel>Application</Channel>
    <Computer>Server.domain.local</Computer>
    <Security UserID="bla bla bla" />
  </System>
  <EventData>
    <Data>System.ServiceModel.ServiceHostingEnvironment+HostingManager/3486411</Data>
    <Data>System.ServiceModel.ServiceActivationException: The service '/ServiceApp/ServiceName.svc' cannot be activated due to an exception during compilation.  The exception message is: The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the HttpsGetUrl property is a relative address, but there is no https base address.  Either supply an https base address or set HttpsGetUrl to an absolute address.. ---&gt; System.InvalidOperationException: The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the HttpsGetUrl property is a relative address, but there is no https base address.  Either supply an https base address or set HttpsGetUrl to an absolute address.
   at System.ServiceModel.Description.ServiceMetadataBehavior.EnsureGetDispatcher(ServiceHostBase host, ServiceMetadataExtension mex, Uri url, String scheme)
   at System.ServiceModel.Description.ServiceMetadataBehavior.CreateHttpGetEndpoints(ServiceDescription description, ServiceHostBase host, ServiceMetadataExtension mex)
   at System.ServiceModel.Description.ServiceMetadataBehavior.ApplyBehavior(ServiceDescription description, ServiceHostBase host)
   at System.ServiceModel.Description.ServiceMetadataBehavior.System.ServiceModel.Description.IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase)
   at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
   at System.ServiceModel.ServiceHostBase.InitializeRuntime()
   at System.ServiceModel.ServiceHostBase.OnBeginOpen()
   at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
   --- End of inner exception stack trace ---
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)</Data>
    <Data>w3wp</Data>
    <Data>4520</Data>
  </EventData>
</Event>
2
Shouldn't the httpsGetUrl start with https:?Tim
yes tryed also that (edit) but no help still same error like its not reading the setting I even searched if I have ServiceMetadata somewhere else in the app but no. So it is somehow like the IIS is not reading the setting from the config fileJester
Added the endpoint configuration can't put the whole webconfig here for some reason. Hope it helps someone to help me with thisJester

2 Answers

1
votes

You have declared serviceMetadata twice, which is not necessary. Also, you supply a httpsGetUrl (with a http address) while you don't want to use it.

Try this:

<serviceMetadata httpGetEnabled="true"
                 httpGetUrl="http://localhost:10001/ServiceName"
                 httpsGetEnabled="false"
/>
0
votes

Still don't know what the problem was with this but for other people that might come along this I will post what solved it for me.

First I done the service in .Net 4.5 but since the IIS only supports ASP.NET 4.0 I converted it after to 4.0 by just changing the target framework

I made the whole service again from scratch with .Net 4.0 and this worked as far as the webconfig goes it is much easyer to use:

Factory="System.ServiceModel.Activation.WebServiceHostFactory"

And remove the system.serviceModel element alltogether from the WebConfig.

So my conclusion was that the switch from .Net framework 4.5 -> 4.0 was what caused the problem (VS 2013).

Hope helps someone