【问题标题】:System.ArgumentNullException in Mono ASP.NET Web ServiceMono ASP.NET Web 服务中的 System.ArgumentNullException
【发布时间】:2016-02-24 05:41:02
【问题描述】:

我是一个初学者,我不知道去哪里寻找或做什么。 请指导我完成此操作。

我在 ubuntu 14.04 中使用 mono v4.2.1 和 apache2

我设法在 url 中安装了我的 ASP.NET Web 服务:http://myurl/WebService/Service.asmx

但是当我打开它时,我收到了这个错误:

System.ArgumentNullException
Value cannot be null.
Parameter name: path1

Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): mscorlib.
Exception stack trace:
  at System.IO.Path.Combine (System.String path1, System.String path2) <0x40960a80 + 0x00211> in <filename unknown>:0 
  at System.Web.Services.Configuration.WsdlHelpGeneratorElement.get_HelpGeneratorPath () <0x40adbfb0 + 0x0003b> in <filename unknown>:0 
  at System.Web.Services.Protocols.DocumentationServerProtocol.Initialize () <0x40a73d70 + 0x00728> in <filename unknown>:0 
  at System.Web.Services.Protocols.ServerProtocol.SetContext (System.Type type, System.Web.HttpContext context, System.Web.HttpRequest request, System.Web.HttpResponse response) <0x40a72740 + 0x00103> in <filename unknown>:0 
  at System.Web.Services.Protocols.ServerProtocolFactory.Create (System.Type type, System.Web.HttpContext context, System.Web.HttpRequest request, System.Web.HttpResponse response, System.Boolean& abortProcessing) <0x40a72300 + 0x000c2> in <filename unknown>:0 

这是我的 Service.asmx:

<%@ WebService Language="C#" CodeBehind="Service.asmx.cs" Class="ACE.Service" %>

还有 Service.asmx.cs 文件:

using System.Web.Services;

namespace ACE
{
    [WebService(Namespace = "http://myurl/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    public class Service : System.Web.Services.WebService
    {
        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
    }
}

第一点是,它在 Microsoft Visual Studio 中完全可以正常工作,但是 mono 有这个问题。

第二点是,http://myurl/WebService/Service.asmx?wsdl 以 xml 格式打开 OK,但是当我将其添加为 Microsoft Visual Studio 中的服务引用时,它会在此行引发异常:

ServiceSoapClient a = new ServiceSoapClient();

例外:

An unhandled exception of type 'System.InvalidOperationException' occurred in System.ServiceModel.dll
Additional information: An endpoint configuration section for contract 'ServiceReference1.ServiceSoap' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.

但是当我在 Microsoft Visual Studio 调试模式下部署我的 Web 服务时,它不会抛出此异常,但 mono 会抛出它。

【问题讨论】:

    标签: asp.net web-services exception mono argumentnullexception


    【解决方案1】:

    我发现是因为mono的版本。

    我删除了官方 mono 存储库的所有组件并安装了 ubuntu mono-complete 包,它已得到修复。

    【讨论】:

      猜你喜欢
      • 2016-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-09
      • 1970-01-01
      相关资源
      最近更新 更多