将Web服务放在生产服务器上后收到奇怪的错误

时间:2011-03-29 13:31:08

标签: .net service asmx

Wen我为我的网络服务运行本地调试它显示得很好。但是当我把它放到我的服务器上时,我得到一个像XML Markup错误这样的奇怪错误。

 XML Parsing Error: mismatched tag. Expected: </p>.
Location: http://-----/2/api/api.asmx
Line Number 61, Column 17:              </ul>

下面是我的asmx文件。我有一个Twitter和OAuth课程。但我认为问题是网站生成时会产生错误。

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.SqlClient;
using WebAPI;

namespace API
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://-----/2/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [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 api : System.Web.Services.WebService
    {
        WebAPI.OAuth oauth;
        WebAPI.Twitter twitter;

        public api()
        {
            oauth = new OAuth();        // Initialize OAuth api
                // Initialize Twittr api
                                        // <@TODO: Add facebook initialize>
                                        // <@TODO: Add linkedIn initialize>
                                        // <@TODO: Add myspace initialize>                                  

        }


        [WebMethod]
        public string post(string ID, string api, string postadata)
        {
            // Validate ID
            /*
             * Call Validate then go to below. (should have flags for what is allowed)
            */

            if (api.ToLower() == "twitter")
            {
                twitter = new Twitter(postadata);
                twitter.DoRequest();
                return twitter.GetResponse();
            }

            if (api.ToLower() == "facebook")
            {
                return "Success";
            }

            return "Invalid API type!";



        }
    }
}

哦,我的Web服务器是一个Windows Web服务器,目前所有的.NET都可以使用.NET 3.5(2.0集成)。如果还有什么需要我发布,请告诉我。像Web.config等。

提前谢谢!

1 个答案:

答案 0 :(得分:0)

所以我很确定我的Web.Config存在问题。我最终制作了一个新的.NET服务项目并移植了代码。它工作正常。