I have been unable to make batching work in Web host scenarios with our latest code. I tried using Brad Wilson's batching sample from his blog post and also the HostedBatch sample in public asp.net samples.
This looks like a regression due to addition of the following check (in both GetRouteData & GetVirutalPath of HostedHttpRouteCollection)
```
if (httpContextBase.GetHttpRequestMessage() == null)
{
httpContextBase.SetHttpRequestMessage(request);
}
```
I receive the following error in case of an embedded batch request's processing:
--aefa68bf-368b-439e-b77e-fed0dc918f69
Content-Type: application/http; msgtype=response
HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
__System.NotImplementedException: The method or operation is not implemented.__
at System.Web.HttpContextBase.get_Items()
at System.Web.Http.WebHost.Routing.HttpContextBaseExtensions.GetHttpRequestMessage(HttpContextBase context) in d:\Web
StackRuntime\Runtime\src\System.Web.Http.WebHost\Routing\HttpContextBaseExtensions.cs:line 18
at System.Web.Http.WebHost.Routing.HostedHttpRouteCollection.GetRouteData(HttpRequestMessage request) in d:\WebStackR
untime\Runtime\src\System.Web.Http.WebHost\Routing\HostedHttpRouteCollection.cs:line 83
at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellat
ionToken) in d:\WebStackRuntime\Runtime\src\System.Web.Http\Dispatcher\HttpRoutingDispatcher.cs:line 67
at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Web.Http.HttpServer.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) in d:\WebSta
ckRuntime\Runtime\src\System.Web.Http\HttpServer.cs:line 157
at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at BatchingAndAttributeRouting.BatchHandler.<SendAsync>d__0.MoveNext() in c:\Users\kichalla\Dropbox\SampleApps\Batchi
ngAndAttributeRouting\BatchHandler.cs:line 52
Repro:
1. Get the HostedBatch sample and run it. you should see it working.
2. Upgrade the nugget packages to MyGet nightly.
3. Run the sample, you should see 400 Bad Request for all the inner requests. If you debug you should see the above mentioned exception.
Comments: Verified.
This looks like a regression due to addition of the following check (in both GetRouteData & GetVirutalPath of HostedHttpRouteCollection)
```
if (httpContextBase.GetHttpRequestMessage() == null)
{
httpContextBase.SetHttpRequestMessage(request);
}
```
I receive the following error in case of an embedded batch request's processing:
--aefa68bf-368b-439e-b77e-fed0dc918f69
Content-Type: application/http; msgtype=response
HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
__System.NotImplementedException: The method or operation is not implemented.__
at System.Web.HttpContextBase.get_Items()
at System.Web.Http.WebHost.Routing.HttpContextBaseExtensions.GetHttpRequestMessage(HttpContextBase context) in d:\Web
StackRuntime\Runtime\src\System.Web.Http.WebHost\Routing\HttpContextBaseExtensions.cs:line 18
at System.Web.Http.WebHost.Routing.HostedHttpRouteCollection.GetRouteData(HttpRequestMessage request) in d:\WebStackR
untime\Runtime\src\System.Web.Http.WebHost\Routing\HostedHttpRouteCollection.cs:line 83
at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellat
ionToken) in d:\WebStackRuntime\Runtime\src\System.Web.Http\Dispatcher\HttpRoutingDispatcher.cs:line 67
at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Web.Http.HttpServer.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) in d:\WebSta
ckRuntime\Runtime\src\System.Web.Http\HttpServer.cs:line 157
at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at BatchingAndAttributeRouting.BatchHandler.<SendAsync>d__0.MoveNext() in c:\Users\kichalla\Dropbox\SampleApps\Batchi
ngAndAttributeRouting\BatchHandler.cs:line 52
Repro:
1. Get the HostedBatch sample and run it. you should see it working.
2. Upgrade the nugget packages to MyGet nightly.
3. Run the sample, you should see 400 Bad Request for all the inner requests. If you debug you should see the above mentioned exception.
Comments: Verified.