English 中文(简体)
当网络服务方法出现例外时,如何获得错误的信息。
原标题:How to get error message when a webservice method throw exception.

I use WebServiceProxy.invoke to call a webservice Method. I realized that one of the parameter is a function to handle error that coming when the method throw an exception.

我尝试了get_message()的方法,以获取错误信息。 当我从当地人那里获得这一机会时,这种工作就告别。 但是,当我从遥远的计算机中获取这一方法时,电文因标准错误而改变:

callws = function (args) {
    // call webservice to fill content panel
    Sys.Net.WebServiceProxy.invoke(_servicePath, _serviceMethod, false,
            { contextKey: args }, Function.createDelegate(this, onSubmitComplete),
              Function.createDelegate(this, onSubmitError), args);
    }

onSubmitComplete = function (result, userContext, methodName) {
    ...
}

onSubmitError = function (result, userContext, methodName) {
    // note: this result.get_message() contain exception message when
    // accessed from localhost, but contain "There was an error processing the request"
    // when accessed from remote computer
    alert(result.get_message());
}
问题回答

ASP.net 运行时间错误并不意味着在部署环境中向客户显示,你的服务器被正确地配置,不显示<>mode的旗帜http://msdn.microsoft.com/en-us/library/h0hfz6fc%28v=vs.100%29.aspx” rel=“nofollow”>_customErrors >载于您的代码>。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!