Bug 25444 - WCF method with UriTemplate annotation fails with InvalidOperationException
Summary: WCF method with UriTemplate annotation fails with InvalidOperationException
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-12-17 00:01 UTC by bonhagjeffrey
Modified: 2017-11-23 18:13 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Example WCF method (344 bytes, application/octet-stream)
2014-12-17 00:01 UTC, bonhagjeffrey
Web.config (1.29 KB, application/octet-stream)
2014-12-17 00:02 UTC, bonhagjeffrey

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 25444 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description bonhagjeffrey 2014-12-17 00:01:30 UTC
Created attachment 9095 [details]
Example WCF method

This is on Mono 3.10 on Fedora installed from the official Xamarin repositories,
but also can be reproduced on a Mac with the latest version of Xamarin Studio.

I can't seem to get the UriTemplate annotation to work on my WCF methods.  For the attached example,
I should be able to perform a GET request against /MyService.svc/Books/2,
but that request fails with a 500 error:

[System.InvalidOperationException]: HttpListenerContext does not match any of the registered channels
  at System.ServiceModel.Channels.Http.HttpListenerManager.ProcessNewContext (System.ServiceModel.Channels.Http.HttpContextInfo ctxi) [0x00000] in <filename unknown>:0 
  at System.ServiceModel.Channels.SvcHttpHandler.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0 
  at System.Web.HttpApplication+<Pipeline>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0 
  at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0 

The same method works on Windows/.NET, and I don't seem to have any trouble with any other WCF methods --
just those using the UriTemplate annotation.

Testing was done using xsp4, version and curl.

My Web.config:

<?xml version="1.0"?>

    <compilation debug="true" targetFramework="4.0" />
      <service name="UriTemplateTester.MyService">
        <endpoint address="" behaviorConfiguration="UriTemplateTester.MyServiceAspNetHttpBehavior"
          binding="webHttpBinding" contract="UriTemplateTester.MyService" />
        <behavior name="UriTemplateTester.MyServiceAspNetHttpBehavior">
          <webHttp />
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <modules runAllManagedModulesForAllRequests="true"/>
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
    <directoryBrowse enabled="true"/>


Thank you for your consideration.
Comment 1 bonhagjeffrey 2014-12-17 00:02:15 UTC
Created attachment 9096 [details]
Comment 2 Roman 2017-03-17 21:15:08 UTC
Hm, It's shown that nobody take problem for resolving! It's very bad!