In Visual Studio 2010, I am trying to connect to a web service I have written. I am trying to include the web service project in my WPF solution so I can debug locally, if necessary but, I would also be happy to just publish the web service to my local IIS and connect to it that way.
Here’s what happens. I include the web service project in my WPF solution so, I have two projects…the WPF and the WCF web service. I try to add a service reference to my WPF project by opening the Add Service Reference dialog box and clicking the “Discover” button. In the address bar, this uri appears:
http://localhost:49185/MyAppSqlServerProvider.svc
I give the service a name in the Namespace text box, and then I click “OK”. Then, I receive the following error:
System.InvalidOperationException: Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].
This seems to be a common error. I have found lots of posts about it, and about how to fix it but, I haven’t been able to apply those solutions to my situation and get them to work.
Here is the relevant portion of my web.config file
<system.serviceModel>
<services>
<service behaviorConfiguration="MyAppDataSync.MyAppSqlServerProviderBehavior"
name="MyAppDataSync.MyAppSqlServerProvider">
<endpoint address="" binding="wsHttpBinding" contract="MyAppDataSync.IMyAppSqlServerProvider" bindingConfiguration="wsHttpBindingConfiguration">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/MyAppSqlServerProvider/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyAppDataSync.MyAppSqlServerProviderBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBindingConfiguration" maxReceivedMessageSize="10485760">
<readerQuotas maxArrayLength="10485760" />
<security mode="Transport">
<transport clientCredentialType="None">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
</wsHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
By the way: I am using transport security because I need to use sessions for this service. (ex: [ServiceContract(SessionMode = SessionMode.Required)])
If anyone can advise me on what I have gotten wrong in my setup, I would really appreciate it. (Why does the “49185” port number get added to the localhost address?)
Thanks in advance for any help you can provide.
You need to change your base address to specify “https” rather than “http”.