System.ArgumentNullException 单声道 ASP.NET Web 服务
System.ArgumentNullException in Mono ASP.NET Web Service
我是初学者,我不知道去哪里看或做什么。
请指导我完成这个。
我在 ubuntu 14.04
中使用 mono v4.2.1 和 apache2
我设法在 url 中安装了我的 ASP.NET 网络服务: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 中完全正常,但单声道有这个问题。
第二点是,http://myurl/WebService/Service.asmx?wsdl 以 xml 格式打开正常,但是当我将其添加为 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版本的问题
我删除了官方 mono 存储库的所有组件并安装了 ubuntu mono-complete 软件包,它已修复。
我是初学者,我不知道去哪里看或做什么。 请指导我完成这个。
我在 ubuntu 14.04
中使用 mono v4.2.1 和 apache2我设法在 url 中安装了我的 ASP.NET 网络服务: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 中完全正常,但单声道有这个问题。
第二点是,http://myurl/WebService/Service.asmx?wsdl 以 xml 格式打开正常,但是当我将其添加为 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版本的问题
我删除了官方 mono 存储库的所有组件并安装了 ubuntu mono-complete 软件包,它已修复。