using NLog; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; namespace TsSFCDeviceService { [WebService(Namespace = "http://www.TechScan.cn/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。 // [System.Web.Script.Services.ScriptService] public class deviceData : System.Web.Services.WebService { private static readonly Logger log = LogManager.GetCurrentClassLogger(); [WebMethod(Description = "测试")] public string HelloWorld() { //HttpAuthtication(); return "Hello World"; } } //private void HttpAuthtication() //{ // #region 校验 // if (authentication == null || !authentication.ValidUser(authentication.Username, authentication.Password)) // { // HttpException soapEx = new HttpException(403, "服务不允许访问此页面,也不允许匿名访问。"); // SvcLog.Warn(string.Format("客户端[{0}]我们试图执行远程匿名访问Func[{1}]!这是被禁止的!", HttpContext.Current.Request.UserHostAddress, "GetDatas"), soapEx); // throw soapEx; // } // #endregion 校验 //} }