2015-06-16 25 views
7

Tôi có một ứng dụng sử dụng dịch vụ web với ASP.Net và có nghĩa vụ phải duy trì. Vì vậy, tôi đã mài sắc kỹ năng của mình về chủ đề này. Tôi không gặp vấn đề khi chạy Webservice trong Window với VS 2013 nhưng có vấn đề với mono.Dịch vụ web không hoạt động trong mono 4

Đây là lỗi tôi nhận được khi tôi chạy mã

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) [0x00006] in <filename unknown>:0 
    at System.Web.Services.Configuration.WsdlHelpGeneratorElement.get_HelpGeneratorPath() [0x0000c] in <filename unknown>:0 
    at System.Web.Services.Protocols.DocumentationServerProtocol.Initialize() [0x001f1] 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) [0x00022] 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) [0x00014] in <filename unknown>:0 

và đây là các mã

WebService1.asmx

<%@ WebService Language="C#" CodeBehind="WebService1.asmx.cs" Class="DemoService.WebService1" %> 

WebService1.asmx.cs

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.Services; 
using System.Xml; 

namespace DemoService 
{ 
    /// <summary> 
    /// Summary description for WebService1 
    /// </summary> 
    [WebService(Namespace = "http://tempuri.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 WebService1 : System.Web.Services.WebService 
    { 

     [WebMethod] 
     public string HelloWorld() 
     { 
      return "Hello World"; 
     } 

     [WebMethod] 
     public XmlElement AddMe(int a, int b) 
     { 
      XmlDocument doc = new XmlDocument(); 
      for(int i=0; i<5; i++) 
      { 
       XmlNode n = doc.CreateNode(XmlNodeType.Element, i.ToString(), "me.com.aisee"); 
       for(int j=0; j<5; j++) 
       { 
        //n.AppendChild(doc.CreateElement(j.ToString())); 
       } 
      } 

      return doc.DocumentElement; 

     } 
    } 
} 

Tôi không phải những gì tôi bỏ lỡ ở đây. theo hiểu biết tốt nhất của tôi, nó chỉ hoạt động tốt. Đây là phiên bản Mono của tôi

~$ mono --version 
Mono JIT compiler version 4.3.0 (tarball Fri Jun 12 11:43:58 UTC 2015) 
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com 
    TLS:   __thread 
    SIGSEGV:  altstack 
    Notifications: epoll 
    Architecture: amd64 
    Disabled:  none 
    Misc:   softdebug 
    LLVM:   supported, not enabled. 
    GC:   sgen 
+0

'Phiên bản trình biên dịch JIT 4.3.0' không phải là phiên bản ổn định hiện tại? – ChrFin

+0

Có. Tôi đã có vấn đề với IoC với ổn định và cập nhật để dev mới nhất và vấn đề biến mất. Bây giờ tôi phải đối mặt với "goliath" –

+0

Có lẽ không có gì sai với mã của bạn; Tôi có cùng một vấn đề. Khi tôi sao chép mã và hội đồng đến một hộp chạy mono 4.0.1 nó hoạt động như nó phải! – Lix

Trả lời

1

Có vẻ như trang Tài liệu cho webservice Chưa thực hiện. Nhưng webservice sẽ hoạt động mặc dù lỗi này. Bạn có thể xem bằng cách thêm ?WSDL vào cuối url, nghĩa là http://localhost/WebService1.asmx?WSDL

Các vấn đề liên quan