views:

29

answers:

2

Hi,

I'm trying to deploy a WCF-service, but I'm having dificulties getting the final bits to work. I'm not a deployment guru in any way, so please bear with me.

I'm using a WebHttpBinding to make Ajax calls to the service using JSON, but I receive the error: "Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [].".

Here is a snippet of my web.config:

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
      <baseAddressPrefixFilters>
        <add prefix="http://mysite.com/" />
      </baseAddressPrefixFilters>
    </serviceHostingEnvironment>
    <bindings>
        <webHttpBinding>
            <binding name="webHttp">
                <security mode="None">
                    <transport clientCredentialType="None"
                    proxyCredentialType="None"
                    realm="string" />
                </security>
            </binding>
        </webHttpBinding>
    </bindings>
        <services>  
      <service name="LicenseManager.LicenseService" behaviorConfiguration="ServiceAspNetAjaxBehavior">
        <endpoint address="" behaviorConfiguration="AjaxBehavior"
         binding="webHttpBinding" contract="LicenseManager.ILicenseService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
               <baseAddresses>
                    <add baseAddress="http://mysite.com/" />
               </baseAddresses>
          </host>
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="AjaxBehavior">
          <enableWebScript/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="ServiceAspNetAjaxBehavior">
          <serviceMetadata httpGetEnabled="true" httpGetUrl="" />
          <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors> 
    </behaviors>
  </system.serviceModel>

I've made so many changes and tried so many options that I honestly lost overview of what I'm doing. I hope you can find that tiny error that make it all work.

Thank you.

A: 

Is your site running directly under http://mysite.com, or is it running under an application/vdir under that site? If so, add the application in your <baseAddressPrefixFilter> element:

  <baseAddressPrefixFilters>
    <add prefix="http://mysite.com/MyApplication" />
  </baseAddressPrefixFilters>

I don't think you need the trailing / either - but I don't think that's causing the issue.

Hopefully this helps! Let em know and I'll update my answer accordingly.

David Hoerster
Thank you for the response.It's running in a directory like http://mysite.com/dir, but that's what i'm pointing to in my config. I've removed the trailing slash, but the error remains.
Jeppebm
I didn't realize my answer didn't format my web.config as code, so it was hidden. I've updated it. If you change your web.config to reflect the additional prefix, does that help?
David Hoerster
Thanks, but this just leads to the error: "This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.". Any other ideas what could be wrong?
Jeppebm
What if you remove `http://mysite.com`?
David Hoerster
Unfortunately no, I've tried them all :/
Jeppebm
A: 

The error was caused by a silly mistake made by me. My DNS was not set up yet, so I used GoDaddy's "Preview DNS" feature that lets me view the website before the DNS is set up. I used the preview address (mydomain.com.previewdns.com) when I should just have used mydomain.com.

My bad, thanks for the help!

Jeppebm