Ed "Over" Ip

30 Jan, 2009

Running WCF on GoDaddy

Posted by: eip In: Tech

GoDaddy and many ASP.NET hosting company operate IIS under medium trust.  As such,  you will need to make a number of modifications to your app.config/web.config to make WCF work.  Assuming your WCF service is compiled against the 3.5 framework, the following is a list of errors I encountered along the way and the respective solution.

Error:
There is no build provider registered for the extension ‘.svc’. You can register one in the <compilation><buildProviders> section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value ‘Web’ or ‘All’.

Solution:

<compilation>
     <buildProviders>
          <add extension=".svc" type="System.ServiceModel.Activation.ServiceBuildProvider, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
     </buildProviders>
</compilation> 

Error:
This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection.

Solution:

<system.serviceModel>
  ...
      <serviceHostingEnvironment>
      <baseAddressPrefixFilters>
           <add prefix="http://services.edoverip.com/" />
      </baseAddressPrefixFilters>
   </serviceHostingEnvironment>
  ...
</system.serviceModel> 

Error:
The WSHttpBinding with name WSHttpBinding failed validation because it contains a BindingElement with type System.ServiceModel.Channels.SymmetricSecurityBindingElement which is not supported in partial trust. Consider disabling the message security and reliable session options, using BasicHttpBinding, or hosting your application in a full-trust environment.

Solution:
This one is a bit tricky.  If you prefer to use wsHttpBinding, you will have to set the Security Mode to either None or Transport.  For example,  to set it to None, it looks something like this…

<bindings>
   <wsHttpBinding>
        <binding name="wsHttp">
            <security mode="None" />
        </binding>
   </wsHttpBinding>
</bindings>

<services>
     <service behaviorConfiguration="DistanceWS.ServiceBehavior" name="DistanceWS.Service">
          <endpoint binding="wsHttpBinding" bindingConfiguration="wsHttp" contract="DistanceWS.IService" />
          <host>
               <baseAddresses>
                    <add baseAddress="http://localhost:8731/Design_Time_Addresses/DistanceWS/Service/" />
               </baseAddresses>
          </host>
     </service>
</services>

That’s all I can think of for now. I will update this post if I come across anything else. Meanwhile, enjoy and good luck!

Related Articles:


Tags: ,

15 Responses to "Running WCF on GoDaddy"

1 | shankar

April 4th, 2009 at 2:39 pm

Avatar

Saved my day! I think this is the best description of godaddy setup for WCF. kudos!

2 | Craig

April 4th, 2009 at 4:24 pm

Avatar

Any idea what to do with this one (hosted at godaddy)?

XML Parsing Error: no element found
Location: http://www.blah.com/MyService.svc?wsdl
Line Number 1, Column 1:

3 | eip

April 6th, 2009 at 12:40 pm

Avatar

Hi Craig,

Not sure since the location is now showing 404.

Ed

4 | Matt

July 24th, 2009 at 11:08 am

Avatar

Awesome! Thanks for taking the time to doucment this Ed.

5 | Mark

August 5th, 2009 at 11:19 am

Avatar

How about CS0246: The type or namespace name ‘OperationContract’ could not be found (are you missing a using directive or an assembly reference?)

6 | eip

August 5th, 2009 at 11:35 am

Avatar

Hey Mark…do you have a reference to System.ServiceModel.dll in your project? Also, is System.ServiceModel in your “Using” statements?

7 | Ajay Singh

August 8th, 2009 at 11:09 am

Avatar

This is exactly what I was looking for.

From past one year, answers of 90% of my questions I got through blog posts like this one. Really hats off to this community of bloggers who takes time to post these kinds of blog so that others can benefit.

Keep up the good work.

8 | Euo

September 3rd, 2009 at 9:08 pm

Avatar

I would try this. I already gave up deploying application that uses WCF at godaddy.

9 | Clarke Isackson

October 4th, 2009 at 7:14 am

Avatar

This is also exactly what I was looking for. Applying your three steps set the config file straight and the service is now performaing. Adding bindingConfiguration=”wsHttp” was really the touch I needed.

Thank you for your time and investigation for us GoDaddy folks.

10 | Pah Joker

November 11th, 2009 at 12:18 am

Avatar

Wow…can only guess at how much time you just saved me. Thanks much!

11 | Adam

December 12th, 2009 at 11:26 pm

Avatar

Thank you! It worked great for me and saved me a lot of time!

12 | Adam

December 30th, 2009 at 4:07 am

Avatar

I agree, this was a huge help. It would have taken me hours to figure it out and it actually helped me to understand some of the config blocks. What’s more I’ll be able to expose my service on GoDaddy and learn a lot more about real world SOA applications.

13 | Adam

December 30th, 2009 at 4:12 am

Avatar

BTW, following up on 5 | Mark above. I had the same problem at first. I was trying to do on-demand compile of my service. After I figured out to precompile first, the three steps started working. So I assume there is something that provides the reference to System.ServiceModel when I do run the service locally.

I also had to futz with some of the system.WebServer settings. You have to guess about what lower level config settings they are using.

Thanks again for the post.

14 | Jay

January 8th, 2010 at 9:07 am

Avatar

Hey, you saved my day. This the best solution to this error.

15 | Darran

March 2nd, 2010 at 12:36 pm

Avatar

Thanks very much.

Comment Form