Failure of simple attempt to rebuild HelloResource project in empty MVC 3 app

Topics: Web Api
Jan 30, 2011 at 6:02 PM

The provided URI scheme 'https' is invalid; expected 'http'.
Parameter name: context.ListenUriBaseAddress

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: The provided URI scheme 'https' is invalid; expected 'http'.
Parameter name: context.ListenUriBaseAddress

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentException: The provided URI scheme 'https' is invalid; expected 'http'.
Parameter name: context.ListenUriBaseAddress]
   System.ServiceModel.Channels.TransportChannelListener..ctor(TransportBindingElement bindingElement, BindingContext context, MessageEncoderFactory defaultMessageEncoderFactory, HostNameComparisonMode hostNameComparisonMode) +16219601
   System.ServiceModel.Channels.HttpChannelListener..ctor(HttpTransportBindingElement bindingElement, BindingContext context) +215
   System.ServiceModel.Channels.HttpTransportBindingElement.BuildChannelListener(BindingContext context) +131
   System.ServiceModel.Channels.HttpMessageEncodingBindingElement.BuildChannelListener(BindingContext context) +634
   System.ServiceModel.Channels.Binding.BuildChannelListener(Uri listenUriBaseAddress, String listenUriRelativeAddress, ListenUriMode listenUriMode, BindingParameterCollection parameters) +177
   System.ServiceModel.Description.DispatcherBuilder.MaybeCreateListener(Boolean actuallyCreate, Type[] supportedChannels, Binding binding, BindingParameterCollection parameters, Uri listenUriBaseAddress, String listenUriRelativeAddress, ListenUriMode listenUriMode, ServiceThrottle throttle, IChannelListener& result, Boolean supportContextSession) +393
   System.ServiceModel.Description.DispatcherBuilder.BuildChannelListener(StuffPerListenUriInfo stuff, ServiceHostBase serviceHost, Uri listenUri, ListenUriMode listenUriMode, Boolean supportContextSession, IChannelListener& result) +572
   System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost) +1940
   System.ServiceModel.ServiceHostBase.InitializeRuntime() +82
   System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) +64
   System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +789
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +287
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +1132

[ServiceActivationException: The service '/HelloWcfRest/Hello' cannot be activated due to an exception during compilation.  The exception message is: The provided URI scheme 'https' is invalid; expected 'http'.
Parameter name: context.ListenUriBaseAddress.]
   System.Runtime.AsyncResult.End(IAsyncResult result) +890624
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +180062
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +136

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.208

Jan 30, 2011 at 9:47 PM


The app wasn't tested with mvc 3, it was tested with an empty application. I don't see why it wouldn't work. Just out of curioisity did you open Visual Studio / run as Administrator? You have to do that whewn you use our source. 

I will take a look though to see if there is any specific issue.


Feb 1, 2011 at 12:19 AM

That error seems like the generic WCF error you get if you try and access a WCF service using the wrong URI.  For instance, it seems like you're trying to access your service via "https://localhost/HelloWcfRest/Hello", though your WCF service does not have transport security enabled.  Are you able to access the service via "http://localhost/HelloWcfRest/Hello" (note the http:// instead of https://)?  (You'll also have to replace the "localhost" with the correct machine name and port.)

Feb 10, 2011 at 5:41 PM

I just received this error today as well.


I am hitting my service via ip and port, not localhost and not over https.

It happens only on the resource I setup with latest wcf http bits, all my other resource endpoints still work as expected.


Feb 10, 2011 at 6:15 PM

I should note, my service is not running within an mvc3 project. 

I added a new resource to an existing WCF4 restful service using the HttpHostConfiguration and extension method "Addserviceroute", and when I hit that endpoint, I get the same error as above.

May 20, 2011 at 8:56 PM

When running in IIS 7.5 (Express) - I do not see this issue.  I do see it when I deploy the service to IIS 6.