C# &引用;服务器上发生错误;在web浏览器中查看所有XML web服务错误

C# &引用;服务器上发生错误;在web浏览器中查看所有XML web服务错误,c#,asp.net-mvc,web-services,C#,Asp.net Mvc,Web Services,我不知道如何解决这个问题,但我已经创建了一个web服务,它将XML返回给用户,并且在调试过程中,在出现所有错误时,我收到的只是web浏览器中的以下确切文本: An error occurred on the server. 在我多年来创建的其他每一个C#应用程序中,代码中都会出现错误。显然,这使得调试代码非常困难,特别是当错误发生在输入任何代码之前时 我真的不知道该去哪里找 我在我的解决方案中搜索了此文本,但它在我的任何文件中都不存在 web.config包含: <system.w

我不知道如何解决这个问题,但我已经创建了一个web服务,它将XML返回给用户,并且在调试过程中,在出现所有错误时,我收到的只是web浏览器中的以下确切文本:

 An error occurred on the server.
在我多年来创建的其他每一个C#应用程序中,代码中都会出现错误。显然,这使得调试代码非常困难,特别是当错误发生在输入任何代码之前时

我真的不知道该去哪里找

我在我的解决方案中搜索了此文本,但它在我的任何文件中都不存在

web.config包含:

  <system.web>
    <customErrors mode="Off" />
    <webServices>
      <diagnostics suppressReturningExceptions="true" />
      <protocols>
        <add name="HttpSoap" />
        <add name="HttpPost" />
        <add name="HttpGet" />
      </protocols>
    </webServices>
webservice类本身是这样开始的:

    [WebService(Namespace = "http://CarReports.org")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class CarService : System.Web.Services.WebService
{


    [WebMethod(EnableSession = true)]
    public CarOptionsModel CurrentOptions(string serialNo)
    {
        ...
    }

我真的不知道还能去哪里找,谷歌搜索“服务器上发生了错误”是不可能的。

我最终通过启用“仅我的代码”解决了这个问题。也许是我错误地禁用了它


调试->选项和设置…->调试->常规->仅启用我的代码

是否尝试添加错误筛选器?另外,在web.config中查找customErrors元素。我没有customErrors元素。你是否建议我尝试在global.asax.cs中添加一个错误过滤器?想想看,我确实尝试在global.asax中添加了“protectedvoid Application_error(Object sender,EventArgs e)”,但从未被命中。不,我指的是一个
IExceptionFilter
(我认为在ASP.NET MVC中就是这样调用的)我刚刚尝试添加System.Web.Mvc.ExceptionContext筛选器,但在出现错误时未触发该筛选器。不过我会尝试其他方法。听起来这可能是一个很好的解决办法。
    [WebService(Namespace = "http://CarReports.org")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class CarService : System.Web.Services.WebService
{


    [WebMethod(EnableSession = true)]
    public CarOptionsModel CurrentOptions(string serialNo)
    {
        ...
    }