将 Web 服务放在生产服务器上后收到奇怪的错误
当我为我的网络服务运行本地调试时,它显示得很好。但是当我将它放到我的服务器上时,我收到一个奇怪的错误,例如 XML 标记错误。
XML 解析错误:标签不匹配。预期:。 位置:http://-----/2/api/api.asmx 第 61 行,第 17 列:
下面是我的 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 3.5(2.0 集成)的所有可用 .NET。如果您还需要我发布其他内容,请告诉我。像Web.config等。
提前谢谢您!
Wen i run the local debug for my web service it shows up just fine. but when I put it up to my server I get a strange error like an XML Markup error.
XML Parsing Error: mismatched tag. Expected: </p>. Location: http://-----/2/api/api.asmx Line Number 61, Column 17: </ul>
Below is my asmx file. I have a Twitter and OAuth class. But I think the issue is when the website is generated it creates an error.
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!";
}
}
}
Oh and my Webserver is a windows web server with all the .NET's available currently using .NET 3.5 (2.0 Integrated). Let me know if there is anything else you need me to post. like the Web.config etc.
Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以我很确定我的 Web.Config 有问题。我最终创建了一个新的 .NET 服务项目并将代码移植过来。而且效果很好。
So I am pretty sure I had an issue with my Web.Config. I ended up making a new .NET service project and porting the code over. and it works fine.