Webservice HttpStatusCode 500但不在浏览器中

时间:2015-01-25 13:53:35

标签: c# web-services wcf-binding

当我启动新的HttpBasicBinding到尚未启动的Web服务时,因为应用程序池未启动将导致内部服务器错误500.但是当我从浏览器启动Web服务时,服务正在启动

如何在发送新请求之前启动Web服务?

在我的代码下面:

    BasicHttpBinding binding = new BasicHttpBinding();
                binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
                binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
                binding.Name = "AXDocumentBinding";

                EndpointAddress address = new EndpointAddress(serviceUrl);

AA_DynamicsAXDocuHandlingClient cls = new AA_DynamicsAXDocuHandlingClient(binding, address);
                cls.ClientCredentials.Windows.ClientCredential = new NetworkCredential(username, password, domain);

string retVal = cls.loadDocumentStr(AreaId, documentFileName, documentIdentification1, documentIdentification2, documentIdentification3, documentIdentification4, documentIdentification5, documentTable);

提前致谢

0 个答案:

没有答案