c# – Web服务在单声道4中不起作用

前端之家收集整理的这篇文章主要介绍了c# – Web服务在单声道4中不起作用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个使用Web服务与ASP.Net的应用程序,我应该维护.所以我在这个主题上提高了我的技能.我在使用VS 2013的Window中运行Webservice没有问题但是有单声道问题.

这是我运行代码时遇到的错误

  1. System.ArgumentNullException
  2. Value cannot be null.
  3. Parameter name: path1
  4.  
  5. Description: HTTP 500.Error processing request.
  6.  
  7. Details: Non-web exception. Exception origin (name of application or object): mscorlib.
  8. Exception stack trace:
  9. at System.IO.Path.Combine (System.String path1,System.String path2) [0x00006] in <filename unknown>:0
  10. at System.Web.Services.Configuration.WsdlHelpGeneratorElement.get_HelpGeneratorPath () [0x0000c] in <filename unknown>:0
  11. at System.Web.Services.Protocols.DocumentationServerProtocol.Initialize () [0x001f1] in <filename unknown>:0
  12. 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
  13. at System.Web.Services.Protocols.ServerProtocolFactory.Create (System.Type type,System.Web.HttpResponse response,System.Boolean& abortProcessing) [0x00014] in <filename unknown>:0

这是代码

WebService1.asmx

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

WebService1.asmx.cs

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Services;
  6. using System.Xml;
  7.  
  8. namespace DemoService
  9. {
  10. /// <summary>
  11. /// Summary description for WebService1
  12. /// </summary>
  13. [WebService(Namespace = "http://tempuri.org/")]
  14. [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  15. [System.ComponentModel.ToolBoxItem(false)]
  16. // To allow this Web Service to be called from script,using ASP.NET AJAX,uncomment the following line.
  17. // [System.Web.Script.Services.ScriptService]
  18. public class WebService1 : System.Web.Services.WebService
  19. {
  20.  
  21. [WebMethod]
  22. public string HelloWorld()
  23. {
  24. return "Hello World";
  25. }
  26.  
  27. [WebMethod]
  28. public XmlElement AddMe(int a,int b)
  29. {
  30. XmlDocument doc = new XmlDocument();
  31. for(int i=0; i<5; i++)
  32. {
  33. XmlNode n = doc.CreateNode( XmlNodeType.Element,i.ToString(),"me.com.aisee");
  34. for(int j=0; j<5; j++)
  35. {
  36. //n.AppendChild(doc.CreateElement(j.ToString()));
  37. }
  38. }
  39.  
  40. return doc.DocumentElement;
  41.  
  42. }
  43. }
  44. }

我不是我想念的.据我所知,它应该工作正常.这是我的Mono版本

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

解决方法

猜你在找的C#相关文章