• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ServerType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ServerType的典型用法代码示例。如果您正苦于以下问题:C# ServerType类的具体用法?C# ServerType怎么用?C# ServerType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ServerType类属于命名空间,在下文中一共展示了ServerType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SendRequest

 protected void SendRequest(string rPath, Dict<string, string> rArgs, ServerType rType, Action<WWW> rOnResponse)
 {
     var url = HttpServerHost + rPath;
     useServerType = rType;
     WaitingLayer.Show();
     this.StartCoroutine(GET(url, rArgs, rOnResponse));
 }
开发者ID:meta-42,项目名称:uEasyKit,代码行数:7,代码来源:HttpRequestBase.cs


示例2: Open

        public void Open(string aConnectionString, ServerType serverType)
        {
            dbCache.ConnectionString = aConnectionString;
            dbCache.ServerType = serverType;
            switch (serverType)
            {
                case ServerType.Firebird:
                    connection = new FbConnection {ConnectionString = aConnectionString};
                    break;
                case ServerType.MsSql:
                    connection = new SqlConnection { ConnectionString = aConnectionString };
                    break;
            }
            connection.Open();

            if (serverType==ServerType.Firebird)
                using (var transaction = connection.BeginTransaction())
                {
                    DbData.GetFieldValue(connection, transaction,
                        "select rdb$set_context('USER_SESSION','RPL_SERVICE','1') from rdb$database;");
                    transaction.Commit();
                }

            var t = new Thread(LoadData);
            t.Start();
        }
开发者ID:kutsoff,项目名称:Fias,代码行数:26,代码来源:FiasDbUpdateWorker.cs


示例3: CreateReadPreferenceDocument

        public static BsonDocument CreateReadPreferenceDocument(ServerType serverType, ReadPreference readPreference)
        {
            if (readPreference == null)
            {
                return null;
            }
            if (serverType != ServerType.ShardRouter)
            {
                return null;
            }

            BsonArray tagSets = null;
            if (readPreference.TagSets != null && readPreference.TagSets.Any())
            {
                tagSets = new BsonArray(readPreference.TagSets.Select(ts => new BsonDocument(ts.Tags.Select(t => new BsonElement(t.Name, t.Value)))));
            }
            else if (readPreference.ReadPreferenceMode == ReadPreferenceMode.Primary || readPreference.ReadPreferenceMode == ReadPreferenceMode.SecondaryPreferred)
            {
                return null;
            }

            var readPreferenceString = readPreference.ReadPreferenceMode.ToString();
            readPreferenceString = Char.ToLowerInvariant(readPreferenceString[0]) + readPreferenceString.Substring(1);

            return new BsonDocument
            {
                { "mode", readPreferenceString },
                { "tags", tagSets, tagSets != null }
            };
        }
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:30,代码来源:QueryHelper.cs


示例4: DeploymentParameters

        /// <summary>
        /// Creates an instance of <see cref="DeploymentParameters"/>.
        /// </summary>
        /// <param name="applicationPath">Source code location of the target location to be deployed.</param>
        /// <param name="serverType">Where to be deployed on.</param>
        /// <param name="runtimeFlavor">Flavor of the clr to run against.</param>
        /// <param name="runtimeArchitecture">Architecture of the runtime to be used.</param>
        public DeploymentParameters(
            string applicationPath,
            ServerType serverType,
            RuntimeFlavor runtimeFlavor,
            RuntimeArchitecture runtimeArchitecture)
        {
            if (string.IsNullOrEmpty(applicationPath))
            {
                throw new ArgumentException("Value cannot be null.", nameof(applicationPath));
            }

            if (!Directory.Exists(applicationPath))
            {
                throw new DirectoryNotFoundException(string.Format("Application path {0} does not exist.", applicationPath));
            }

            if (runtimeArchitecture == RuntimeArchitecture.x86)
            {
                throw new NotSupportedException("32 bit compilation is not yet supported. Don't remove the tests, just disable them for now.");
            }

            ApplicationPath = applicationPath;
            ServerType = serverType;
            RuntimeFlavor = runtimeFlavor;
            EnvironmentVariables.Add(new KeyValuePair<string, string>("ASPNETCORE_DETAILEDERRORS", "true"));
        }
开发者ID:akrisiun,项目名称:Hosting,代码行数:33,代码来源:DeploymentParameters.cs


示例5: RunSite

        private async Task RunSite(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
        {
            await TestServices.RunSiteTest(
                SiteName,
                server,
                runtimeFlavor,
                architecture,
                applicationBaseUrl,
                async (httpClient, logger, token) =>
                {
                    // ===== English =====
                    var response = await RetryHelper.RetryRequest(async () =>
                    {
                        return await httpClient.GetAsync(string.Empty);
                    }, logger, token, retryCount: 30);

                    var responseText = await response.Content.ReadAsStringAsync();

                    var headingIndex = responseText.IndexOf("<h2>Application uses</h2>");
                    Assert.True(headingIndex >= 0);

                    // ===== French =====
                    response = await RetryHelper.RetryRequest(async () =>
                    {
                        return await httpClient.GetAsync("?culture=fr&ui-culture=fr");
                    }, logger, token, retryCount: 30);

                    responseText = await response.Content.ReadAsStringAsync();
                    
                    headingIndex = responseText.IndexOf("<h2>Utilisations d'application</h2>");
                    Assert.True(headingIndex >= 0);
                });
        }
开发者ID:leloulight,项目名称:Entropy,代码行数:33,代码来源:LocalizationWebTests.cs


示例6: ExistingPage

        private async Task ExistingPage(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
        {
            await TestServices.RunSiteTest(
                SiteName,
                server,
                runtimeFlavor,
                architecture,
                applicationBaseUrl,
                async (httpClient, logger, token) =>
                {
                    var response = await RetryHelper.RetryRequest(async () =>
                    {
                        return await httpClient.GetAsync(string.Empty);
                    }, logger, token, retryCount: 30);

                    var responseText = await response.Content.ReadAsStringAsync();

                    logger.LogResponseOnFailedAssert(response, responseText, () =>
                    {
                        string expectedText = "Hello World, try /bob to get a 404";
                        Assert.Equal(expectedText, responseText);

                        Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                    });
                });
        }
开发者ID:leloulight,项目名称:Entropy,代码行数:26,代码来源:DiagnosticsStatusCodesMvcTests.cs


示例7: CreateNew

        //-----------------------------------------------------------------------------
        public SilkroadServer CreateNew(string bind_addr, int bind_port, string module_addr, int module_port, ServerType srvtype, bool blowfish, bool sec_bytes, bool handshake, PacketDispatcher packetProcessor, DelayedPacketDispatcher delayedPacketDispatcher, List<RedirectRule> redirs = null)
        {
            if (BindExists(bind_addr, bind_port))
            {
                Global.logmgr.WriteLog(LogLevel.Error, "Server with given bind address already exists [{0}:{1}]", bind_addr, bind_port);
                return null;
            }
            try
            {
                SilkroadServer ServerItem =
                    new SilkroadServer(
                        new IPEndPoint(IPAddress.Parse(bind_addr), bind_port),
                        new IPEndPoint(IPAddress.Parse(module_addr), module_port),
                        srvtype,
                        blowfish,
                        sec_bytes,
                        handshake,
                        packetProcessor,
                        delayedPacketDispatcher,
                        redirs
                        );

                m_servers.Add(ServerItem);
                ServerItem.Start();
                return ServerItem;
            }
            catch
            {
                Global.logmgr.WriteLog(LogLevel.Error, "ServerManager failed to start server, SilkroadServer start error");
            }
            return null;
        }
开发者ID:Noex188,项目名称:SilkroadProtection,代码行数:33,代码来源:ServerManager.cs


示例8: RunSite

        private async Task RunSite(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
        {
            await TestServices.RunSiteTest(
                SiteName,
                serverType,
                runtimeFlavor,
                architecture,
                applicationBaseUrl,
                async (httpClient, logger, token) =>
                {
                    var response = await RetryHelper.RetryRequest(async () =>
                    {
                        return await httpClient.GetAsync(string.Empty);
                    }, logger, token, retryCount: 30);

                    var responseText = await response.Content.ReadAsStringAsync();
                    string expectedText =
"Retry Count 42\r\n" +
"Default Ad Block House\r\n" +
"Ad Block Contoso Origin sql-789 Product Code contoso2014\r\n" +
"Ad Block House Origin blob-456 Product Code 123\r\n";

                    logger.LogResponseOnFailedAssert(response, responseText, () =>
                    {
                        Assert.Equal(expectedText, responseText);
                    });
                });
        }
开发者ID:leloulight,项目名称:Entropy,代码行数:28,代码来源:ConfigSettingObjectWebTests.cs


示例9: ApplicationSettings

 public ApplicationSettings(string connectionString, ServerType serverType, string nameSpace, string assemblyName)
 {
     ConnectionString = connectionString;
     ServerType = serverType;
     NameSpace = nameSpace;
     AssemblyName = assemblyName;
 }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:7,代码来源:ApplicationSettings.cs


示例10: AssertMappedTypes

 private static void AssertMappedTypes(ServerType serverType, DataTypeMapper mapper, Type expectedType, params string[] dataTypes)
 {
     foreach (string dataType in dataTypes)
     {
         Assert.AreEqual(expectedType, mapper.MapFromDBType(serverType, dataType, null, null, null));
     }
 }
开发者ID:stantoxt,项目名称:NHibernateMappingGenerator_Patched,代码行数:7,代码来源:DataTypeMapperTest.cs


示例11: RunSiteTest

        public static async Task RunSiteTest(string siteName, ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl,
            Func<HttpClient, ILogger, CancellationToken, Task> validator)
        {
            var logger = new LoggerFactory()
                            .AddConsole()
                            .CreateLogger(string.Format("{0}:{1}:{2}:{3}", siteName, serverType, runtimeFlavor, architecture));

            using (logger.BeginScope("RunSiteTest"))
            {
                var deploymentParameters = new DeploymentParameters(GetPathToApplication(siteName), serverType, runtimeFlavor, architecture)
                {
                    ApplicationBaseUriHint = applicationBaseUrl,
                    SiteName = "HttpTestSite",
                };

                using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
                {
                    var deploymentResult = deployer.Deploy();
                    var httpClientHandler = new HttpClientHandler();
                    var httpClient = new HttpClient(httpClientHandler)
                    {
                        BaseAddress = new Uri(deploymentResult.ApplicationBaseUri),
                        Timeout = TimeSpan.FromSeconds(10)
                    };

                    await validator(httpClient, logger, deploymentResult.HostShutdownToken);
                }
            }
        }
开发者ID:leloulight,项目名称:Entropy,代码行数:29,代码来源:TestServices.cs


示例12: GetVersionHint

        internal static string GetVersionHint(SqlVersion version, ServerType serverType)
        {
            if (serverType == ServerType.Cloud)
            {
                Debug.Assert(version >= SqlVersion.Sql11);
                return SqlProviderManifest.TokenAzure11;
            }

            switch (version)
            {
                case SqlVersion.Sql8:
                    return SqlProviderManifest.TokenSql8;

                case SqlVersion.Sql9:
                    return SqlProviderManifest.TokenSql9;

                case SqlVersion.Sql10:
                    return SqlProviderManifest.TokenSql10;

                case SqlVersion.Sql11:
                    return SqlProviderManifest.TokenSql11;

                default:
                    throw new ArgumentException(Strings.UnableToDetermineStoreVersion);
            }
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:26,代码来源:SqlVersionUtils.cs


示例13: GetReader

        public static IMetadataReader GetReader(ServerType serverType, string connectionStr)
        {
            IMetadataReader metadataReader;
            switch(serverType)
            {
                case ServerType.Oracle:
                    metadataReader = new OracleMetadataReader(connectionStr);
                    break;
                case ServerType.SqlServer:
                    metadataReader = new SqlServerMetadataReader(connectionStr);
                    break;
                case ServerType.SqlCe:
                    metadataReader = new SqlCeMetadataReader(connectionStr);
                    break;
                default:
                    metadataReader = new OracleMetadataReader(connectionStr);
                    break;
            }
            /*if (serverType == ServerType.Oracle)
            {

            }
            else
            {

            }*/
            return metadataReader;
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:28,代码来源:MetadataFactory.cs


示例14: MessageEventArgs

 public MessageEventArgs(MessageType messtype, ServerType servertype, String arguments, String message)
 {
     messagetype = messtype;
     type = servertype;
     args = arguments;
     Message = message;
 }
开发者ID:swganhtools,项目名称:anhtoolsservice,代码行数:7,代码来源:MessageEventArgs.cs


示例15: CreateReadPreferenceDocument

        public static BsonDocument CreateReadPreferenceDocument(ServerType serverType, ReadPreference readPreference)
        {
            if (serverType != ServerType.ShardRouter || readPreference == null)
            {
                return null;
            }

            BsonArray tagSets = null;
            if (readPreference.TagSets != null && readPreference.TagSets.Count > 0)
            {
                tagSets = new BsonArray(readPreference.TagSets.Select(ts => new BsonDocument(ts.Tags.Select(t => new BsonElement(t.Name, t.Value)))));
            }

            // simple ReadPreferences of Primary and SecondaryPreferred are encoded in the slaveOk bit
            if (readPreference.ReadPreferenceMode == ReadPreferenceMode.Primary || readPreference.ReadPreferenceMode == ReadPreferenceMode.SecondaryPreferred)
            {
                if (tagSets == null && !readPreference.MaxStaleness.HasValue)
                {
                    return null;
                }
            }

            var modeString = readPreference.ReadPreferenceMode.ToString();
            modeString = Char.ToLowerInvariant(modeString[0]) + modeString.Substring(1);

            return new BsonDocument
            {
                { "mode", modeString },
                { "tags", tagSets, tagSets != null },
                { "maxStalenessSeconds", () => (int)readPreference.MaxStaleness.Value.TotalSeconds, readPreference.MaxStaleness.HasValue }
            };
        }
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:32,代码来源:QueryHelper.cs


示例16: OpenIdConnect_OnX86

 public async Task OpenIdConnect_OnX86(
     ServerType serverType,
     RuntimeFlavor runtimeFlavor,
     RuntimeArchitecture architecture,
     string applicationBaseUrl)
 {
     await OpenIdConnectTestSuite(serverType, runtimeFlavor, architecture, applicationBaseUrl);
 }
开发者ID:leloulight,项目名称:MusicStore,代码行数:8,代码来源:OpenIdConnectTests.cs


示例17: Contains

		public bool Contains(ServerType serverType)
		{
			if ((this.ServerType & serverType) == 0)
			{
				return false;
			}
			return true;
		}
开发者ID:adan830,项目名称:Egametang,代码行数:8,代码来源:ConfigAttribute.cs


示例18: NtlmAuthenticationTest

        public async Task NtlmAuthenticationTest(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
        {
            var logger = new LoggerFactory()
                            .AddConsole(LogLevel.Warning)
                            .CreateLogger(string.Format("Ntlm:{0}:{1}:{2}", serverType, runtimeFlavor, architecture));

            using (logger.BeginScope("NtlmAuthenticationTest"))
            {
                var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty);
                var connectionString = string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName);

                var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture)
                {
                    ApplicationBaseUriHint = applicationBaseUrl,
                    EnvironmentName = "NtlmAuthentication", //Will pick the Start class named 'StartupNtlmAuthentication'
                    ApplicationHostConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("NtlmAuthentation.config") : null,
                    SiteName = "MusicStoreNtlmAuthentication", //This is configured in the NtlmAuthentication.config
                    UserAdditionalCleanup = parameters =>
                    {
                        if (!Helpers.RunningOnMono)
                        {
                            // Mono uses InMemoryStore
                            DbUtils.DropDatabase(musicStoreDbName, logger);
                        }
                    }
                };

                // Override the connection strings using environment based configuration
                deploymentParameters.EnvironmentVariables
                    .Add(new KeyValuePair<string, string>(
                        "SQLAZURECONNSTR_DefaultConnection",
                        string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName)));

                using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
                {
                    var deploymentResult = deployer.Deploy();
                    var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true };
                    var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) };

                    // Request to base address and check if various parts of the body are rendered & measure the cold startup time.
                    var response = await RetryHelper.RetryRequest(async () =>
                    {
                        return await httpClient.GetAsync(string.Empty);
                    }, logger: logger, cancellationToken: deploymentResult.HostShutdownToken);

                    Assert.False(response == null, "Response object is null because the client could not " +
                        "connect to the server after multiple retries");

                    var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult);
                    await validator.VerifyNtlmHomePage(response);

                    //Should be able to access the store as the Startup adds necessary permissions for the current user
                    await validator.AccessStoreWithPermissions();

                    logger.LogInformation("Variation completed successfully.");
                }
            }
        }
开发者ID:rosslyn-cuongle,项目名称:MusicStore,代码行数:58,代码来源:NtlmAuthentationTest.cs


示例19: HelloWorld

        public async Task HelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ServerType delegateServer, ApplicationType applicationType)
        {
            var logger = new LoggerFactory()
                            .AddConsole()
                            .AddDebug()
                            .CreateLogger($"HelloWorld:{serverType}:{runtimeFlavor}:{architecture}:{delegateServer}");

            using (logger.BeginScope("HelloWorldTest"))
            {
                var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(applicationType), serverType, runtimeFlavor, architecture)
                {
                    ApplicationBaseUriHint = applicationBaseUrl,
                    EnvironmentName = "HelloWorld", // Will pick the Start class named 'StartupHelloWorld',
                    ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null,
                    SiteName = "HttpTestSite", // This is configured in the Http.config
                    TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0",
                    ApplicationType = applicationType
                };

                using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
                {
                    var deploymentResult = deployer.Deploy();
                    var httpClientHandler = new HttpClientHandler();
                    var httpClient = new HttpClient(httpClientHandler)
                    {
                        BaseAddress = new Uri(deploymentResult.ApplicationBaseUri),
                        Timeout = TimeSpan.FromSeconds(5),
                    };

                    // Request to base address and check if various parts of the body are rendered & measure the cold startup time.
                    var response = await RetryHelper.RetryRequest(() =>
                    {
                        return httpClient.GetAsync(string.Empty);
                    }, logger, deploymentResult.HostShutdownToken, retryCount: 30);

                    var responseText = await response.Content.ReadAsStringAsync();
                    try
                    {
                        Assert.Equal("Hello World", responseText);

                        response = await httpClient.GetAsync("/Path%3F%3F?query");
                        responseText = await response.Content.ReadAsStringAsync();
                        Assert.Equal("/Path??", responseText);

                        response = await httpClient.GetAsync("/Query%3FPath?query?");
                        responseText = await response.Content.ReadAsStringAsync();
                        Assert.Equal("?query?", responseText);
                    }
                    catch (XunitException)
                    {
                        logger.LogWarning(response.ToString());
                        logger.LogWarning(responseText);
                        throw;
                    }
                }
            }
        }
开发者ID:aspnet,项目名称:IISIntegration,代码行数:57,代码来源:HelloWorldTest.cs


示例20: GetOperationImp

        public static IDeployOperation GetOperationImp(ServerType serverType)
        {
            if (serverType == ServerType.MSFolder)
                return new MSFolderOperation();
            if (serverType == ServerType.SSH)
                return new SSHOperation();

            return new SVNOperation();
        }
开发者ID:dragon753,项目名称:Deployer,代码行数:9,代码来源:DeployUtil.cs



注:本文中的ServerType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ServerValidateEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# ServerStatusFlags类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap