2015-11-21 94 views
0

我是初學者,我不知道在哪裏看或做什麼。 請指導我完成此操作。Mono ASP.NET Web服務中的System.ArgumentNullException

我使用單V4.2.1和Apache2的在Ubuntu 14.04

我設法安裝我的ASP.NET Web服務的URL: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"; 
     } 
    } 
} 

第一點是,它工作在微軟的Visual Studio完全確定,但單有這個問題。

第二點是,http://myurl/WebService/Service.asmx?wsdl打開XML格式的確定,但是當我將其添加爲微軟的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服務時,它不會拋出此異常,但單聲道拋出它。

回答

0

我想通了,這是因爲單聲道的版本。

我刪除了官方的單庫的所有部件,並安裝了Ubuntu 單完整包,它是固定的。