502在WCF应用程序中调用服务时出现网关错误

时间:2019-04-23 02:09:19

标签: c# wcf sharepoint-2013 ms-project-server-2013

我有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));

enter image description here

无法读取正确的响应,而是收到502 Bad gateway error

编辑

这两个服务都托管在http而非https上。

0 个答案:

没有答案