using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Security; using System.Web.SessionState; using QMAPP.FJC.Entity.Basic; using OpcHost.Init; using System.ServiceModel; using System.ServiceModel.Channels; namespace OpcHost { public class Global : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { //NetTcpBinding bind = new NetTcpBinding(); //Uri uri = new Uri("net.tcp://192.168.0.106:9256/PLCService");//从配置文件中读取服务的Url //ServiceHost host = new ServiceHost(typeof(OpcHost.PLCService), uri); ////if中的代码可以没有,但是如果想利用Svctuil.exe生成代理类的时候,就需要下面的代码,否则将会报错,无法解析元数据 //if (host.Description.Behaviors.Find() == null) //{ // BindingElement metaElement = new TcpTransportBindingElement(); // CustomBinding metaBind = new CustomBinding(metaElement); // host.Description.Behaviors.Add(new System.ServiceModel.Description.ServiceMetadataBehavior()); // host.AddServiceEndpoint(typeof(System.ServiceModel.Description.IMetadataExchange), metaBind, "MEX"); //} //host.Open(); //Console.WriteLine("聊天室服务器开始监听: endpoint {0}", uri.ToString()); //Console.WriteLine("按 ENTER 停止服务器监听..."); //Console.ReadLine(); //host.Abort(); //host.Close(); //获取生产设备 ParaInit.InitParameter(); } protected void Session_Start(object sender, EventArgs e) { //配置日志处理组件 QMFrameWork.Log.LogManager.Configure("log4net"); } protected void Application_BeginRequest(object sender, EventArgs e) { } protected void Application_AuthenticateRequest(object sender, EventArgs e) { } protected void Application_Error(object sender, EventArgs e) { } protected void Session_End(object sender, EventArgs e) { } protected void Application_End(object sender, EventArgs e) { } } }