0

我是一个初学者,我不知道去哪里看或做什么。请指导我完成这个。

我在 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 服务时,它不会抛出这个异常,而是单声道会抛出它。

4

1 回答 1

0

我发现这是因为单声道的版本。

我删除了官方单声道存储库的所有组件并安装了 ubuntu 单声道完整包,它已得到修复。

于 2015-11-24T18:18:49.917 回答