예제 #1
0
파일: Program.cs 프로젝트: yuriik83/UA-.NET
        /// <summary>
        /// Creates and starts a HTTP server.
        /// </summary>
        private static TestServer CreateHttpServer(ushort port, ushort keySize, bool useAnsiCStack)
        {
            TestServer server = new TestServer(port);

            ApplicationConfiguration configuration = ApplicationConfiguration.Load("Opc.Ua.Server", ApplicationType.Server);

            configuration.ApplicationName = Utils.Format("UA StackTest Server (Http-{0})", keySize);
            configuration.ApplicationUri = Utils.Format("http://{0}/{1}", System.Net.Dns.GetHostName(), configuration.ApplicationName);

            string subjectName = Utils.Format("CN={1}/DC={0}", System.Net.Dns.GetHostName(), configuration.ApplicationName);

            configuration.SecurityConfiguration.ApplicationCertificate.RawData = null;
            configuration.SecurityConfiguration.ApplicationCertificate.Thumbprint = null;
            configuration.SecurityConfiguration.ApplicationCertificate.SubjectName = subjectName;

            // set base addresses.
            string url = Utils.Format("http://{0}:{1}/StackTestServer/{2}", System.Net.Dns.GetHostName(), port, keySize);

            configuration.ServerConfiguration.BaseAddresses.Clear();
            configuration.ServerConfiguration.BaseAddresses.Add(url);

            GuiUtils.CheckApplicationInstanceCertificate(configuration, keySize, false, false);

            // start server.
            server.Start(configuration);
            TestUtils.InitializeContexts(server.MessageContext);

            return server;
        }
예제 #2
0
 /// <summary>
 /// This constructor gets the test server configuration.
 /// </summary>
 /// <param name="server"></param>
 public MainForm(TestServer server)
 {
     InitializeComponent();
     this.Icon = this.TrayIcon.Icon = Opc.Ua.Configuration.ConfigUtils.GetAppIcon();
     m_server = server;
 }