"An error occurred on the server." in web browser on all XML web service errors

时间:2015-06-25 18:56:21

标签: c# asp.net-mvc web-services

I'm not sure how to present this problem, but I've created a web service that returns XML to the user, and while debugging, on all errors, all I receive is this exact text in the web browser: An error occurred on the server. In every other C# application I've created over the years, errors break within the code. Obviously, this makes it very difficult to debug code, especially when the error happens prior to any code being entered. I really don't know where to look. I searched my solution for this text, and it doesn't exist in any of my files. web.config contains: <system.web> <customErrors mode="Off" /> <webServices> <diagnostics suppressReturningExceptions="true" /> <protocols> <add name="HttpSoap" /> <add name="HttpPost" /> <add name="HttpGet" /> </protocols> </webServices> I checked global.asax and it seems normal: protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); } The webservice class itself starts off like this: [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) { ... } I really don't know where else to look, and Googling "An error occurred on the server." is impossible.

1 个答案:

答案 0 :(得分:0)

我最终通过启用“Just My Code”解决了这个问题。也许我错误地禁用了它。

调试 - &gt;选项和设置...-&gt;调试 - &gt;常规 - &gt;启用我的代码