Web 服务在 mono 4 中不起作用 [英] Web Services does not work in mono 4

查看:16
本文介绍了Web 服务在 mono 4 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 ASP.Net 的 Web 服务的应用程序,并且应该维护.所以我在这个话题上提高了我的技能.我在 Window 中使用 VS 2013 运行 Webservice 没有问题,但在单声道方面有问题.

I have an app that uses Webservices with ASP.Net and am supposed to maintain. So I was sharpening my skills on the topic. I have no problem running Webservice in Window with VS 2013 but have issues with mono.

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

Here is the error I get when I run the code

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 

这里是代码

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;

        }
    }
}

我不在这里想念什么.据我所知,它应该可以正常工作.这是我的单声道版本

I don't what I miss here. to the best of my knowledge, it should just work fine. Here is my Mono version

~$ 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

推荐答案

好像还没有实现webservice的文档页面.但是尽管有这个错误,webservice 应该可以工作.可以通过在url末尾添加?WSDL来查看,即http://localhost/WebService1.asmx?WSDL

It looks like Documentation page for webservice is not implemented yet. But the webservice should work despite this error. You can see it by adding ?WSDL at the end of url, i.e http://localhost/WebService1.asmx?WSDL

这篇关于Web 服务在 mono 4 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆