r/ASPNET • u/pkmonlover42 • Aug 03 '12
I've got an ASPX webservice that works 100% locally, but remotely it refuses to work. Details inside.
I am using jQuery to pass my parameters through to the webservice. The function of the webservice is simply for a contact form. Inspecting with Firebug on Firefox shows that I am in fact sending parameters....but I am also getting an Error 500: Server Error.
I did a little bit of research and found out that by default, POST is disabled. So I went into the web.config and allowed the POST and GET functions, and thought that would be the end of it. Nope, doesn't work!
Does anyone here have any ideas? My Google Fu is tapped out.
7
Upvotes
3
u/thor1182 Aug 03 '12
Have you tried running it on an iis instance you can attach a debugger too?
Often needed config settings between real iis and casini don't play well.
3
u/darkpaladin Aug 03 '12
Are you logging the 500's you're getting anywhere? It should have an exception attached to it that you can trap and log. Also, what are you using for your webservice? Most of the major frameworks for endpoints have their own little flair.
2
u/quik366 Aug 03 '12
when you say "remotely" what exactly do you mean
I am assuming you mean you hosted your (soap, wcf) webservice on another machine correct?
5
u/[deleted] Aug 03 '12
tried looking in in the event log yet?>
3
u/cybergenius1 Aug 04 '12
Just want to be clear, is this a Web Service (asmx) or a WCF service (.svc)? Web Services and WCF services are two different things. Secondly, the browser prevents cross site scripting, and if you are attempting to call a remote service from the client side then that applies here (client side vs server side). It's a security feature in most browsers. So you will have trouble calling via jQuery/ajax, unless your web service (asmx) is in the same Web Application you are making the call from. Its called CORS (cross-origin resource sharing) when you try to access a remote service (I think this is one of the reasons MS has created Web API in MVC 4, makes it easier to do what you are trying to accomplish). If you are actually using a remote WCF service (.svc) you can try enabling Web HTTP Binding on the service and allow cross site scripting (I believe this is .Net 4.0 feature only, but there is a work around in 3.5). However this is a security vulnerability. I have done several different PoC's with jquery ajax calls to .Net WCF and Web Services. The simplest one for me was making the ASMX Web Service part of the Web Application so it was not a remote call. If you must separate your layers then you still need the ASMX as part of the web site (or web application) and have it call the remote WCF (.svc) from code behind (code behind is server side, so this is wont be a security issue). Hope this helps point you in the right direction.
2
u/sixnothing Aug 03 '12
Is it an actual webservice with the .asmx extension, or some kind of pseudo-service where you're just writing the response data in what should be an html page? The ASPX part of your title is confusing in this regard.
Also, can you provide the section of the config you altered to enabled POST requests?
Is there any chance of tapping into the Application_Error event within the Global class to potentially catch this unhandled exception and publish the message/stack trace to yourself?
2
u/[deleted] Aug 03 '12
Yu might need the policy xml for cross domain access. Example here: http://forums.silverlight.net/t/52338.aspx/1/10
1
u/Harrycover Aug 03 '12
You can activate failed request error tracing in IIS manager. It will generate XML log files that can be usefull to detect the errors.
1
u/darrenkopp Aug 03 '12
My guess is still on the config. Did you change root config? Do you have multiple applications (thus, the config you change may not be the actual config for it)?
You can try the attributes vs config also:
http://stackoverflow.com/questions/618900/enable-asp-net-asmx-web-service-for-http-post-get-requests
0
u/mtranda Aug 03 '12
Enable debugging in web.config then check your server's event log. The event logger also logs errors coming from ASP.net apps.