Search code examples
wcfmonomod-mono

Problem with WCF Hosting on Mono


I am trying to host a simple application with one .aspx, .asmx and .svc file each. I followed the below guide to achieve the hosting (since I am very new to the linux world, it took a while to understand it!):

http://www.mono-project.com/Mod_mono#Manual_Mod_Mono_Configuration

After all the hosting, I am able to access the aspx and asmx file. But when I try to access the svc file, I get the below error:

The ServiceHost must have at least one application endpoint (that does not include metadata exchange endpoint) defined by either configuration, behaviors or call to AddServiceEndpoint methods.

or

HttpListenerContext does not match any of the registered channels

I do have a pretty straight forward service endpoint defined in my web.config which looks like below:

  <system.serviceModel>
<services>
  <service name="TestWCFService">
    <endpoint address="http://localhost/MonoTest/TestWCFService.svc" binding="basicHttpBinding"
              contract="MonoTest.ITestWCFService"></endpoint>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

Can you please tell me what I am doing wrong?

Note: I used MS VS 2010 to create this project and then published it. The published directory is copied to the Apache/Linux Environment. The WCF doesn't make use of any complex type. I am using Mono Version 2.8.2

UPDATE Update: I tried using 2.10.2 Mono. This error is gone and I am now facing a new one:

XmlSchema error: Named item http://tempuri.org/:DoWork was already contained in the schema object table. Consider setting MONO_STRICT_MS_COMPLIANT to 'yes' to mimic MS implementation. Related schema item SourceUri: , Line 0, Position 0.

Solution

  • After weeks of R&D on this I have figured out this. For some reason, I can't get the service WSDL to work (meaning I can't access the .svc from browser). However, the service works fine when I try to access it using Channel Factory.

    So I have implemented everything in Channel Factory (for my Silverlight app) and everything seems to be working fine right now. I am still not sure how to get WSDL to work but that's not too important to me as of now.