Cannot access ESBRestService on some machines

Jun 24, 2012 at 9:36 PM
Edited Jun 24, 2012 at 9:39 PM

Hi, and thanks for the great project!

One thing I'm having trouble with, is some kind of apparently an inconstant and unexplained behavior of the ESBRestService.

On some machines – it works like a charm, on others, when trying to run the JS API WebChat sample from a browser not supporting WebSocket (i.e. IE – no pun intended) – I get 404 response from the IIS, on the call
POST http://localhost:8087/ESBRestService/RegisterTopic?ReThrowException=false&ESBUserName=&ESBPassword=

I checked and doubled-checked the versions of the IIS (7.5 both on the working machines and on those that return the error) the configuration, and anything I could have think of. Still – there are machines on which the RestAPI works – and on others it isn’t.

Note that on all of them – RabbitMQ is properly installed, and, in addition, on the machines that return 404 to the IE, not surprisingly – with Firefox, the Chat app works perfectly fine, as it defaults to WebSockets, and doesn't really use the IIS hosted REST service.

It is (probably) not a firewall issue as the tests are performed locally.

Any idea where can I start looking to figure out what’s wrong with the misbehaving machines?

Many thanks,

Black.

Coordinator
Jun 24, 2012 at 11:03 PM
Edited Jun 24, 2012 at 11:05 PM

Which version of IE are you using locally? So far, the only problem i get with using IE is when I host the rest service on a remote server.  If the browser does not support Websocket, it should default to long-polling for receiving data. If you wait for the next version 2.0.1 which is coming up soon, all this problem were resolved including cross browser compatibility of the JS API. You can see the road map for 2.0.1 here http://pservicebus.codeplex.com/wikipage?title=Road%20Map&referringTitle=Home

Coordinator
Jun 24, 2012 at 11:05 PM

One thing to note, if you are getting 404 error you might want to check to make sure that the PServiceBusRest is installed properly on your machine after running the installation.

Jun 25, 2012 at 1:37 PM

I'm using IE 9.0, and as far as I can tell - the PServiceBusRest is installed properly - the site is defined, with the correct binding, and config. Still I think it's something with the configuration of the IIS...

Coordinator
Jun 25, 2012 at 2:34 PM

In regards to IE 9 not working correctly, I believe it is just related to Cross Origin Policy (Maybe you want to look into the X-Requested-With and any header associated with allowing a connection with an IE browser). As for the configuration of IIS below is what is currently been used for setting it up.

 

cacls "%CD%" /E /G IIS_IUSRS:f 

%systemroot%\system32\inetsrv\appcmd add apppool /name:PServiceBusRest /managedRuntimeVersion:v4.0 /managedPipelineMode:Integrated

%systemroot%\system32\inetsrv\appcmd set apppool /apppool.name:PServiceBusRest /enable32BitAppOnWin64:true

%systemroot%\system32\inetsrv\appcmd start apppool /apppool.name:PServiceBusRest

%systemroot%\system32\inetsrv\appcmd add site /name:PServiceBusRest /id:2000 /physicalPath:"%CD%" /bindings:http/*:8087:

%systemroot%\system32\inetsrv\appcmd set site /site.name:PServiceBusRest /[path='/'].applicationPool:PServiceBusRest

%systemroot%\system32\inetsrv\appcmd start site /site.name:PServiceBusRest

 

If you compile from source, you can try adding the following to the code in the PServiceBus.Services.Web. SetHttpStreamHeaders in RestService.cs file. The code belows allowed IE to work for me in 2.0.1 :)

private void SetHttpStreamHeaders() {
            if (HttpContext.Current == null) return;
            var response = HttpContext.Current.Response;
            response.AddHeader("Access-Control-Allow-Origin", "*");
            response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Content-Length, X-REQUESTED-WITH, X-REQUESTED-BY");
            response.AddHeader("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE, OPTIONS");
            response.AddHeader("Access-Control-Max-Age", "1728000");
            response.AddHeader("P3P", "CP=IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT");
            response.AddHeader("Cache-Control", "no-cache, must-revalidate");
            response.AddHeader("Expires", "Sat, 26 Jul 1997 05:00:00 GMT");
        }

Let me know if it works for you.

Jun 25, 2012 at 6:46 PM

Thanks for the detailed and prompt replyed,

However, as I suspected - the IIs was misconfiguered... Noticed that when looking at the Handler mappings - .net 4.0 was installed before the IIS, so a little: "aspnet_regiis -ir" command solved all the issues.

Coordinator
Jun 25, 2012 at 7:32 PM

Great. Problem solved :)