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 (show other bugs)
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)

See Also:
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

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!

Note You need to log in before you can comment on or make changes to this bug.