When using Microsoft ASP.NET AJAX, you can call any webservice you have enabled with the [ScriptService] attribute. This webservice could throw an exception, which ends up on the webpage as a javascript alert. This all works quite nicely, UNTIL you actually deploy such a solution!
Let's say you have a webservice that takes an item and returns some status about that item. When coding your webservice, if you cannot find the item (client passed in an invalid number), you throw an InvalidItemException with a message of 'Item Not Found'. You test this and everything works in development, but when you deploy you get a generic message of 'There was an error processing the request' when the item is not found.
Turns out, this is because you have
Here is an easy solution to this problem. Place all your webservices where you WANT the exception message to be shown in their own separate directory. Then in that directory, put a web.config file that contains
Here are a couple of related blog entries on this same problem.
http://blog.hackedbrain.com/archive/2007/08/03/6121.aspx
http://jlchereau.blogspot.com/2007/03/ajax-extensions-services-always-report.html
Good luck!
No comments:
Post a Comment