Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


WCF Config in web site

Posted on 2010-11-17
Medium Priority
Last Modified: 2012-05-10

I am trying to get a WCF service running in an ASP.Net project (will run in IIS 7 but I can't get it work in visual studio for the moment). The reason why I need WCF is because I want to use MTOM encoding which is not available in a classic webservice. For the same reason I want to configure it so that I can upload large binary messages.

That means that I do need to specify the configuration of the service in web.config.

the service is located in a file called "albumservice.svc" in the root of the website, and the corresponding interface (Ialbumservice) is correctly implemented (albumservice class).

You can find below the web.config file I currently have. With this I am getting the following error when trying to view the service in a browser (the rest of the site works corretly):

Could not find a base address that matches scheme https for the endpoint with binding albumWSbinding. Registered base address schemes are [http].
[InvalidOperationException: Could not find a base address that matches scheme https for the endpoint with binding albumWSbinding. Registered base address schemes are [http].]
   System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri relativeOrAbsoluteUri, Binding binding, UriSchemeKeyedCollection baseAddresses) +12230836
   System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress) +12228189
   System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, ServiceElement serviceSection) +67

I keep looking around but it doesn't look like I am doing anything wrong. Removing the address tag of the endpoint doesn't help. If anyone has any suggestions, they are more than welcome!


      <service name="albumservice" behaviorConfiguration="albumbehavior">
        <endpoint address="albumservice.svc"
        <endpoint binding="mexHttpBinding"
        <binding name="albumWSbinding" maxBufferPoolSize="5000000"
          <security mode="Transport">
            <transport clientCredentialType="None"/>
        <binding name="albumMEXbinding" >
        <behavior name="albumbehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

Open in new window

Question by:cm2187
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
LVL 21

Expert Comment

ID: 34161131
Check this out.  This might help:

You might need to use mexHttpsBinding rather than mexHttpBinding

and you might need to do this <serviceMetadata httpsGetEnabled="true"/> rather than <serviceMetadata httpGetEnabled="true"/>


Author Comment

ID: 34161883
But that's what I don't understand. I am not using https. I am trying to consume this service over regular http.
LVL 21

Expert Comment

ID: 34161904
What is your base address anyway?  Did you set this up programmatically or within config?  Your base Address might be based on https.

something like this under services --> service tag.

            <add baseAddress="http://localhost:8081/test/" />
How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.


Author Comment

ID: 34161948
my understanding was that if the service is hosted in IIS I should not need to specify the base address. Which would force me to hardcode in config some development specific variable.

Author Comment

ID: 34161952
actually asp won't even let me do it:

Error message
When 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' is set to true in configuration, the endpoints are required to specify a relative address. If you are specifying a relative listen URI on the endpoint, then the address can be absolute.
LVL 21

Expert Comment

ID: 34161961
Oh yeah.  You generated a web site project (IIS Hosting) for the WCF service library.  Sorry, I was thinking of something else.

OK.  Your IIS website is based on http, right?  What is the address?  Is it something like "http://localhost/sample/albumservice.svc"?

Author Comment

ID: 34161970
And changing mexHttpBinding to mexHttpsBinding doesn't affect the error

Author Comment

ID: 34161972
Absolutely (while in development)

Author Comment

ID: 34161974
and what is weird is that I I add a new WCF service to the project (but don't alter anything to the web.config) this new service works. Obviously this is not good enough for me as I need that service to use a different encoding and max request size than the values by default. But it doesn't seem to be anything else than something wrong in my web.config
LVL 21

Expert Comment

ID: 34161982
Just checking.  In my case, it is always http.  It should be http in development anyway.  :-)

That is just weird.  Anyway, I'll come back to this later.  I'm going to a meeting now. :-)

Author Comment

ID: 34161987
LVL 21

Accepted Solution

Alfred1 earned 2000 total points
ID: 34163261
OK.  This might be an IIS configuration issue.  Check the link below:

I hope this helps.

Author Closing Comment

ID: 34168872
You did it!
removing the security part from the binding solved the problem! Would have never found that myself!

Thanks for your help!

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : All lightning effects with instructions : http://www.mediaf…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question