我有WCF服务应用程序,该应用程序正在调用另一个WCF服务来处理数据。当作为引用添加到控制台应用程序中时,此应用程序运行良好,但是当我在开发服务器上的IIS中托管该应用程序时,该应用程序不起作用。我一直在代码中进行WCF配置,如下所示
我尝试更改Web.Config文件的协议映射和其他代码级别更改,但没有任何效果
Logging.Log("http://", "Code goes in http:// section");
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
binding.Security.Mode = BasicHttpSecurityMode.None;
binding.Security.Transport.Realm = "";
binding.ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas();
binding.ReaderQuotas.MaxDepth = 32;
binding.ReaderQuotas.MaxArrayLength = 16384;
binding.ReaderQuotas.MaxStringContentLength = 8192;
binding.ReaderQuotas.MaxNameTableCharCount = 500000000;
binding.ReaderQuotas.MaxBytesPerRead = 4096;
binding.Name = "BasicHttpBinding_NTLM";
binding.SendTimeout = new TimeSpan(0, 5, 0); // 1 minute
binding.ReceiveTimeout = new TimeSpan(0, 5, 0); // 1 minute
binding.MaxBufferSize = 500000000;
binding.MaxReceivedMessageSize = 500000000;
ContractDescription contractDescription = ContractDescription.GetContract(typeof(T));
return new ServiceEndpoint(contractDescription, binding, new EndpointAddress(remoteAddress));
无法读取正确的响应,而是收到502 Bad gateway error
编辑
这两个服务都托管在http而非https上。