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

C# ServiceModel.WSHttpBinding类代码示例

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

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



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

示例1: Main

        static void Main(string[] args)
        {
            try
            {
                ServiceHost dataExchangeService = null;
                Uri httpBaseAddress = new Uri(args.Length == 0 ? "http://127.0.0.1:8080" : args[0]);

                dataExchangeService = new ServiceHost(typeof(Service), httpBaseAddress);
                WSHttpBinding binding = new WSHttpBinding();
                binding.Security = new WSHttpSecurity { Mode = SecurityMode.None };

                binding.Security.Transport = new HttpTransportSecurity { ClientCredentialType = HttpClientCredentialType.None };
                binding.MaxBufferPoolSize = 1073741824;
                binding.MaxReceivedMessageSize = 1073741824;
                binding.ReceiveTimeout = TimeSpan.FromHours(1);
                binding.SendTimeout = TimeSpan.FromHours(1);
                binding.ReaderQuotas.MaxArrayLength = 1073741824;
                binding.ReaderQuotas.MaxBytesPerRead = 1073741824;
                binding.ReaderQuotas.MaxDepth = 1073741824;
                binding.ReaderQuotas.MaxStringContentLength = 1073741824;

                dataExchangeService.AddServiceEndpoint(typeof(IDataTranslation), binding, "");
                dataExchangeService.AddServiceEndpoint(typeof(IDataSimulation), binding, "");
                dataExchangeService.Open();
                logger.log("Service is now at: " + httpBaseAddress);
                while (true)
                {
                    Thread.Sleep(10000);
                }
            }
            catch (Exception ex)
            {
                logger.log( ex.Message, Logger.LogType.ERROR);
            }
        }
开发者ID:d4e-uninova,项目名称:dataExchangeSolution,代码行数:35,代码来源:Program.cs


示例2: Main

        private static void Main(string[] args)
        {
            ServiceHost host = new ServiceHost(typeof (EvalService));

            WSHttpBinding noSecurityPlusRMBinding = new WSHttpBinding();
            noSecurityPlusRMBinding.Security.Mode = SecurityMode.None;
            noSecurityPlusRMBinding.ReliableSession.Enabled = true;

            host.AddServiceEndpoint(typeof (IEvalService), new BasicHttpBinding(), "http://localhost:8080/evals/basic");
            host.AddServiceEndpoint(typeof(IEvalService), noSecurityPlusRMBinding, "http://localhost:8080/evals/ws");
            //host.AddServiceEndpoint(typeof (IEvalService), new NetTcpBinding(), "net.tcp://localhost:8081/evals");

            ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
            smb.HttpGetEnabled = true;
            smb.HttpGetUrl = new Uri("http://localhost:8080/evals/basic/meta");
            host.Description.Behaviors.Add(smb);

            try
            {
                host.Open();
                PrintServiceInfo(host);
                Console.ReadLine();
                host.Close();

            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                host.Abort();
            }

            Console.ReadLine();
        }
开发者ID:JeffMck,项目名称:edu-WCF,代码行数:33,代码来源:Program.cs


示例3: Main

        static void Main(string[] args)
        {
            Uri baseAddress = new Uri("http://localhost:8773/WSHttpService");

            WSHttpBinding binding = new WSHttpBinding();

            binding.Name = "WSHttp_Binding";
            binding.HostNameComparisonMode = HostNameComparisonMode.WeakWildcard;
            CustomBinding customBinding = new CustomBinding(binding);
            SymmetricSecurityBindingElement securityBinding = (SymmetricSecurityBindingElement)customBinding.Elements.Find<SecurityBindingElement>();

            /// Change the MaxClockSkew to 2 minutes on both service and client settings.
            TimeSpan newClockSkew = new TimeSpan(0, 2, 0);

            securityBinding.LocalServiceSettings.MaxClockSkew = newClockSkew;
            securityBinding.LocalClientSettings.MaxClockSkew = newClockSkew;

            using (ServiceHost host = new ServiceHost(typeof(WSHttpService), baseAddress))
            {
                host.AddServiceEndpoint(typeof(IWSHttpService), customBinding, "http://localhost:8773/WSHttpService/mex");
                // Enable metadata publishing.
                ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
                smb.HttpGetEnabled = true;
                smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
                host.Description.Behaviors.Add(smb);
                host.Open();

                Console.WriteLine("The service is ready at {0}", baseAddress);
                Console.WriteLine("Press <Enter> to stop the service.");
                Console.ReadLine();

                // Close the ServiceHost.
                host.Close();
            }
        }
开发者ID:zabidin901,项目名称:ReplayAttackWCFProtoType,代码行数:35,代码来源:Program.cs


示例4: Main

	public static void Main ()
	{
		ServiceHost host = new ServiceHost (typeof (Foo));
		WSHttpBinding binding = new WSHttpBinding ();
		binding.Security.Message.EstablishSecurityContext = false;
		binding.Security.Message.NegotiateServiceCredential = false;
		binding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate;
		binding.ReceiveTimeout = TimeSpan.FromSeconds (5);
		host.AddServiceEndpoint ("IFoo",
			binding, new Uri ("http://localhost:8080"));
		ServiceCredentials cred = new ServiceCredentials ();
		cred.ServiceCertificate.Certificate =
			new X509Certificate2 ("test.pfx", "mono");
		cred.ClientCertificate.Authentication.CertificateValidationMode =
			X509CertificateValidationMode.None;
		host.Description.Behaviors.Add (cred);
		host.Description.Behaviors.Find<ServiceDebugBehavior> ()
			.IncludeExceptionDetailInFaults = true;
		foreach (ServiceEndpoint se in host.Description.Endpoints)
			se.Behaviors.Add (new StdErrInspectionBehavior ());
		ServiceMetadataBehavior smb = new ServiceMetadataBehavior ();
		smb.HttpGetEnabled = true;
		smb.HttpGetUrl = new Uri ("http://localhost:8080/wsdl");
		host.Description.Behaviors.Add (smb);
		host.Open ();
		Console.WriteLine ("Hit [CR] key to close ...");
		Console.ReadLine ();
		host.Close ();
	}
开发者ID:alesliehughes,项目名称:olive,代码行数:29,代码来源:samplesvc.cs


示例5: Main

        static void Main(string[] args)
        {
            // Configure IoC
            Container.Register(
                Component.For<IStockLookup>()
                .ImplementedBy<StockLookup>());

            // Configure Host
            using (var host = new ServiceHost(
                typeof(StockLookup),
                new Uri("http://localhost:1701/")))
            {
                var binding = new WSHttpBinding();
                var ep = host.AddServiceEndpoint(
                    typeof(IStockLookup),   // Contract
                    binding,                // Binding
                    "Stock");               // Address

                var ioc = new WindsorServiceBehavior();
                host.Description.Behaviors.Add(ioc);

                host.Open();
                Console.WriteLine("Host is now running...");
                Console.WriteLine(">>> Press Enter To Stop <<<");
                Console.ReadLine();
                host.Close();
            }
        }
开发者ID:trayburn,项目名称:Presentations.WcfTopics,代码行数:28,代码来源:Program.cs


示例6: Main

        static void Main(string[] args)
        {
            var baseAddress = new Uri("https://localhost:44355");

            using (var host = new ServiceHost(typeof(HelloWorldService), baseAddress))
            {
                var binding = new WSHttpBinding(SecurityMode.Transport);
                binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;

                host.Credentials.ServiceCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySubjectName, "localhost");
                host.Credentials.ClientCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck;
                host.Credentials.ClientCertificate.Authentication.TrustedStoreLocation = StoreLocation.LocalMachine;
                host.Credentials.ClientCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.ChainTrust;

                var endpoint = typeof(IHelloWorldService);
                host.AddServiceEndpoint(endpoint, binding, baseAddress);

                var metaBehavior = new ServiceMetadataBehavior();
                metaBehavior.HttpGetEnabled = true;
                metaBehavior.HttpGetUrl = new Uri("http://localhost:9000/mex");
                metaBehavior.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
                host.Description.Behaviors.Add(metaBehavior);

                host.Open();

                Console.WriteLine("Service is ready. Hit enter to stop service.");
                Console.ReadLine();

                host.Close();
            }
        }
开发者ID:DeanMaurer,项目名称:SampleTwoWayTLSWithCerts,代码行数:31,代码来源:Program.cs


示例7: ConfigureServiceHost

        public void ConfigureServiceHost(ServiceHost host, ServiceHostConfigurationArgs args)
        {
            WSHttpBinding binding = new WSHttpBinding();
            binding.MaxReceivedMessageSize = args.MaxReceivedMessageSize;
            binding.ReaderQuotas.MaxStringContentLength = args.MaxReceivedMessageSize;
            binding.ReaderQuotas.MaxArrayLength = args.MaxReceivedMessageSize;
            binding.Security.Mode = WebServicesSettings.Default.SecurityMode;
            binding.Security.Message.ClientCredentialType = args.Authenticated
                                                                ? MessageCredentialType.UserName
                                                                : MessageCredentialType.None;
            // establish endpoint
            host.AddServiceEndpoint(args.ServiceContract, binding, "");

            // expose meta-data via HTTP GET
            ServiceMetadataBehavior metadataBehavior = host.Description.Behaviors.Find<ServiceMetadataBehavior>();
            if (metadataBehavior == null)
            {
                metadataBehavior = new ServiceMetadataBehavior();
                metadataBehavior.HttpGetEnabled = true;
                host.Description.Behaviors.Add(metadataBehavior);
            }

            // set up the certificate 
            if (WebServicesSettings.Default.SecurityMode == SecurityMode.Message 
                || WebServicesSettings.Default.SecurityMode==SecurityMode.TransportWithMessageCredential)
            {
                host.Credentials.ServiceCertificate.SetCertificate(
                    StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySubjectName, args.HostUri.Host);
            }
        }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:30,代码来源:WSHttpConfiguration.cs


示例8: CreateSGDatabase_HClient

 public static SGDatabase_HClient CreateSGDatabase_HClient()
 {
     WSHttpBinding BINDING = new WSHttpBinding();
     WcfClientConfig.ReadBindingConfig(BINDING, "WSHttpBinding_SGDatabase_H");//从配置文件(app.config)读取配置。
     string endpoint = WcfClientConfig.GetWcfRemoteAddress("WSHttpBinding_SGDatabase_H");
     return new SGDatabase_HClient(BINDING, new EndpointAddress(endpoint));
 }
开发者ID:wuhuayun,项目名称:JieLi_Cord,代码行数:7,代码来源:WcfClientFactory.cs


示例9: GetHttpBinding

        public static WSHttpBinding GetHttpBinding()
        {
            var binding = new WSHttpBinding
            {
                MaxBufferPoolSize = 2147483647,
                MaxReceivedMessageSize = 2147483647,
                MessageEncoding = WSMessageEncoding.Mtom,
                TextEncoding = System.Text.Encoding.UTF8,
                ReceiveTimeout = new TimeSpan(0, 0, 1, 0),
                SendTimeout = new TimeSpan(0, 0, 1, 0),
                OpenTimeout = new TimeSpan(0, 0, 1, 0),
                ReaderQuotas =
                {
                    MaxArrayLength = 2147483647,
                    MaxDepth = 2147483647,
                    MaxStringContentLength = 2147483647,
                    MaxBytesPerRead = 2147483647,
                    MaxNameTableCharCount = 2147483647
                },
                ReliableSession = { Enabled = true, InactivityTimeout = new TimeSpan(0, 0, 1, 0) },
                Security = { Mode = SecurityMode.None , Transport = {ClientCredentialType = HttpClientCredentialType.None}}
            };

            return binding;
        }
开发者ID:serkovigor1985,项目名称:RemoteViewer,代码行数:25,代码来源:Utils.cs


示例10: CreateChannel

 static IFileService CreateChannel(string url)
 {
     WSHttpBinding binding = new WSHttpBinding();
       EndpointAddress address = new EndpointAddress(url);
       ChannelFactory<IFileService> factory = new ChannelFactory<IFileService>(binding, address);
       return factory.CreateChannel();
 }
开发者ID:bizarreWizard,项目名称:dependency_analyzer,代码行数:7,代码来源:Client.cs


示例11: Start

        public void Start()
        {
            this.host = new ServiceHost(typeof(NotificationService));

            var binding = new WSHttpBinding
                          {
                              Security =
                              {
                                  Mode = SecurityMode.None
                              }
                          };

            var behavior = new ServiceMetadataBehavior
                           {
                               HttpGetEnabled = true,
                               HttpGetUrl = configuration.Uri
                           };

            this.host.AddServiceEndpoint(typeof(INotificationService), binding, configuration.Uri);

            this.host.AddDependencyInjectionBehavior<NotificationService>(this.container);

            this.host.Description.Behaviors.Add(behavior);

            this.host.Open();
        }
开发者ID:Firebuild,项目名称:Firebuild,代码行数:26,代码来源:NotificationServiceHost.cs


示例12: CanProvideInstanceForHost

        public void CanProvideInstanceForHost()
        {
            using (var container = new UnityContainer())
            {
                //var serviceMock = new Mock<ITestService>();
                //container.RegisterInstance<ITestService>(serviceMock.Object);
                container.RegisterInstance<TestService>(new TestService("Test"));

                var serviceHost = new ServiceHost(typeof(TestService), new Uri("http://localhost:55551/TestService"));
                serviceHost.Description.Behaviors.Add(new UnityServiceBehavior(container));

                Binding binding = new WSHttpBinding();
                var address = new EndpointAddress("http://localhost:55551/TestService/MyService");
                var endpoint = serviceHost
                    .AddServiceEndpoint(typeof(ITestService), binding, address.Uri);

                var smb = new ServiceMetadataBehavior { HttpGetEnabled = true };
                serviceHost.Description.Behaviors.Add(smb);

                var proxy = ChannelFactory<ITestService>.CreateChannel(binding, endpoint.Address);

                serviceHost.Open();

                var result = proxy.TestOperation();

                serviceHost.Close();

                Assert.AreEqual("Test", result);
            }
        }
开发者ID:Detroier,项目名称:playground,代码行数:30,代码来源:UnityServiceBehaviorTest.cs


示例13: soapClient

        /// <summary>
        /// A private function to create the soapclient to communicate with ServiceNOW
        /// </summary>
        /// <param name="UserName">The API Username</param>
        /// <param name="Password">The API Password</param>
        /// <returns>A ServiceNow SoapClient object</returns>
        private static ServiceNowSoapClient soapClient(string UserName, string Password, string ServiceNowUrl)
        {
            try
            {
                EndpointAddress endpoint = new EndpointAddress(new Uri(ServiceNowUrl));
                WSHttpBinding binding = new WSHttpBinding();

                binding.Name = "ServiceNowSoap";
                binding.MaxReceivedMessageSize = 65536;
                binding.Security.Mode = SecurityMode.Transport;
                binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
                binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic;
                binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;

                ServiceNowSoapClient soapClient = new ServiceNowSoapClient(binding, endpoint);
                soapClient.ClientCredentials.UserName.UserName = UserName;
                soapClient.ClientCredentials.UserName.Password = Password;

                return soapClient;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return null;
            }
        }
开发者ID:jeffpatton1971,项目名称:mod-ServiceNOW,代码行数:32,代码来源:incident.cs


示例14: CreateSGDatabase_WClient

 public static SGDatabase_WClient CreateSGDatabase_WClient()
 {
     WSHttpBinding BINDING = new WSHttpBinding();
     SoapClientConfig.ReadBindingConfig(BINDING, "http_ISGDatabase_W");//从配置文件(app.config)读取配置。
     string endpoint = SoapClientConfig.GetSoapRemoteAddress("http_ISGDatabase_W");
     return new SGDatabase_WClient(BINDING, new EndpointAddress(endpoint));//构建WCF客户端实例
 }
开发者ID:wuhuayun,项目名称:JieLi_Cord,代码行数:7,代码来源:SoapClientFactory.cs


示例15: ConfigureServiceHost

		/// <summary>
		/// Configures the specified service host, according to the specified arguments.
		/// </summary>
		/// <param name="host"></param>
		/// <param name="args"></param>
		public void ConfigureServiceHost(ServiceHost host, ServiceHostConfigurationArgs args)
		{
			var binding = new WSHttpBinding();
			binding.MaxReceivedMessageSize = args.MaxReceivedMessageSize;
			if (args.SendTimeoutSeconds > 0)
				binding.SendTimeout = TimeSpan.FromSeconds(args.SendTimeoutSeconds);

			binding.ReaderQuotas.MaxStringContentLength = args.MaxReceivedMessageSize;
			binding.ReaderQuotas.MaxArrayLength = args.MaxReceivedMessageSize;
			binding.Security.Mode = SecurityMode.Message;
			binding.Security.Message.ClientCredentialType = args.Authenticated ?
				MessageCredentialType.UserName : MessageCredentialType.None;

			// establish endpoint
			host.AddServiceEndpoint(args.ServiceContract, binding, "");

			// expose meta-data via HTTP GET
			var metadataBehavior = host.Description.Behaviors.Find<ServiceMetadataBehavior>();
			if (metadataBehavior == null)
			{
				metadataBehavior = new ServiceMetadataBehavior();
				metadataBehavior.HttpGetEnabled = true;
				host.Description.Behaviors.Add(metadataBehavior);
			}

			//TODO (Rockstar): remove this after refactoring to do per-sop edits
			foreach (var endpoint in host.Description.Endpoints)
				foreach (var operation in endpoint.Contract.Operations)
					operation.Behaviors.Find<DataContractSerializerOperationBehavior>().MaxItemsInObjectGraph = args.MaxReceivedMessageSize;

			// set up the certificate - required for WSHttpBinding
			host.Credentials.ServiceCertificate.SetCertificate(
				args.CertificateSearchDirective.StoreLocation, args.CertificateSearchDirective.StoreName,
				args.CertificateSearchDirective.FindType, args.CertificateSearchDirective.FindValue);
		}
开发者ID:jfphilbin,项目名称:ClearCanvas,代码行数:40,代码来源:WSHttpConfiguration.cs


示例16: OpenWCFServer

        /// <summary>
        /// 启动服务
        /// </summary>
        private void OpenWCFServer()
        {
            WSHttpBinding wsHttp = new WSHttpBinding();
            wsHttp.MaxBufferPoolSize = 524288;
            wsHttp.MaxReceivedMessageSize = 2147483647;
            wsHttp.ReaderQuotas.MaxArrayLength = 6553600;
            wsHttp.ReaderQuotas.MaxStringContentLength = 2147483647;
            wsHttp.ReaderQuotas.MaxBytesPerRead = 6553600;
            wsHttp.ReaderQuotas.MaxDepth = 6553600;
            wsHttp.ReaderQuotas.MaxNameTableCharCount = 6553600;
            wsHttp.CloseTimeout = new TimeSpan(0, 1, 0);
            wsHttp.OpenTimeout = new TimeSpan(0, 1, 0);
            wsHttp.ReceiveTimeout = new TimeSpan(0, 10, 0);
            wsHttp.SendTimeout = new TimeSpan(0, 10, 0);
            wsHttp.Security.Mode = SecurityMode.None;

            Uri baseAddress = new Uri("http://127.0.0.1:9999/wcfserver");
            ServiceHost host = new ServiceHost(typeof(WCFServer), baseAddress);

            ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
            smb.HttpGetEnabled = true;
            host.Description.Behaviors.Add(smb);

            ServiceBehaviorAttribute sba = host.Description.Behaviors.Find<ServiceBehaviorAttribute>();
            sba.MaxItemsInObjectGraph = 2147483647;

            host.AddServiceEndpoint(typeof(IWCFServer), wsHttp, "");

            host.Open();
        }
开发者ID:0611163,项目名称:Machine,代码行数:33,代码来源:Form1.cs


示例17: LegacyProvider

        static LegacyProvider()
        {
            WSHttpBinding wsHttpBinding = new WSHttpBinding()
            {
                Security = new WSHttpSecurity()
                {
                    Mode = SecurityMode.Message,
                    Message =
                    {
                        ClientCredentialType = MessageCredentialType.Windows
                    }
                }
            };

            EndpointAddress endpoint = new EndpointAddress(VirtualPathUtility.AppendTrailingSlash(DebuggerConfig.Instance.CMS.Url) + "webservices/CoreService2011.svc/wsHttp");
            ChannelFactory<core.ICoreService> clientFactory = new ChannelFactory<core.ICoreService>(wsHttpBinding, endpoint)
            {
                Credentials =
                {
                    Windows =
                    {
                        ClientCredential = CredentialCache.DefaultNetworkCredentials
                    }
                }
            };

            // Initialize the CoreServiceClient
            mCoreServiceClient = clientFactory.CreateChannel();
        }
开发者ID:mvlasenko,项目名称:TridionVSRazorExtension,代码行数:29,代码来源:LegacyProvider.cs


示例18: GetWcfReference

 public static Object GetWcfReference(Type type, object[] info)
 {
   if (info.Length == 2)
     info = new object[] { info[0], null, info[1] };
   if (info.Length != 3)
     return null;
   Type genType;
   Type factType;
   if (info[0] == null)
   {
     genType = typeof(ChannelFactory<>);
     factType = genType.MakeGenericType(new Type[] { type });
     if (info[1] == null)
       info[1] = new WSHttpBinding();
     info = new object[] { info[1], new EndpointAddress((string)info[2]) };
   }
   else
   {
     genType = typeof(DuplexChannelFactory<>);
     factType = genType.MakeGenericType(new Type[] { type });
     info[0] = new InstanceContext(info[0]);
     info[2] = new EndpointAddress((string)info[2]);
     if (info[1] == null)
       info[1] = new WSDualHttpBinding();
   }
   object factObject = Activator.CreateInstance(factType, info);
   MethodInfo methodInfo = factType.GetMethod("CreateChannel", new Type[] { });
   return methodInfo.Invoke(factObject, null);
 }
开发者ID:Logeshkumar,项目名称:Projects,代码行数:29,代码来源:ServiceRefCreator.cs


示例19: Main

        // Host the service within this EXE console application.
        public static void Main()
        {
            WSHttpBinding binding = new WSHttpBinding();
            binding.Name = "binding1";
            binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
            binding.Security.Mode = SecurityMode.Message;
            binding.ReliableSession.Enabled = false;
            binding.TransactionFlow = false;
            
            Uri baseAddress = new Uri("http://localhost:8000/servicemodelsamples/service");

            // Create a ServiceHost for the CalculatorService type and provide the base address.
            using(ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress))
            {
                serviceHost.AddServiceEndpoint(typeof(ICalculator), binding, baseAddress);
                // Open the ServiceHostBase to create listeners and start listening for messages.
                serviceHost.Open();

                // The service can now be accessed.
                Console.WriteLine("The service is ready.");
                Console.WriteLine("Press <ENTER> to terminate service.");
                Console.WriteLine();
                Console.ReadLine();
                             
            }
                    
        }
开发者ID:ssickles,项目名称:archive,代码行数:28,代码来源:service.cs


示例20: ConfigureServiceHost

		/// <summary>
		/// Configures the specified service host, according to the specified arguments.
		/// </summary>
		/// <param name="host"></param>
		/// <param name="args"></param>
		public void ConfigureServiceHost(ServiceHost host, ServiceHostConfigurationArgs args)
		{
			WSHttpBinding binding = new WSHttpBinding();
			binding.MaxReceivedMessageSize = args.MaxReceivedMessageSize;
            binding.ReaderQuotas.MaxStringContentLength = args.MaxReceivedMessageSize;
            binding.ReaderQuotas.MaxArrayLength = args.MaxReceivedMessageSize;
			binding.Security.Mode = SecurityMode.Message;
			binding.Security.Message.ClientCredentialType = args.Authenticated ?
				MessageCredentialType.UserName : MessageCredentialType.None;

			// establish endpoint
			host.AddServiceEndpoint(args.ServiceContract, binding, "");

			// expose meta-data via HTTP GET
			ServiceMetadataBehavior metadataBehavior = host.Description.Behaviors.Find<ServiceMetadataBehavior>();
			if (metadataBehavior == null)
			{
				metadataBehavior = new ServiceMetadataBehavior();
				metadataBehavior.HttpGetEnabled = true;
				host.Description.Behaviors.Add(metadataBehavior);
			}

			// set up the certificate - required for WSHttpBinding
            host.Credentials.ServiceCertificate.SetCertificate(
                args.CertificateSearchDirective.StoreLocation, args.CertificateSearchDirective.StoreName,
                args.CertificateSearchDirective.FindType, args.CertificateSearchDirective.FindValue);
		}
开发者ID:nhannd,项目名称:Xian,代码行数:32,代码来源:WSHttpConfiguration.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ServiceModel.WebHttpBinding类代码示例发布时间:2022-05-26
下一篇:
C# ServiceModel.ServiceModelDictionary类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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