WCF ServiceHost basicHttpBinding 503错误 [英] WCF ServiceHost basicHttpBinding 503 error

查看:178
本文介绍了WCF ServiceHost basicHttpBinding 503错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows 2007 SP1服务器上将WCF ServiceHost作为NT服务运行. ServiceHost负责托管单个服务端点:具有以下地址的basicHttpBinding:

I'm trying to run a WCF ServiceHost as an NT Service on a Windows 2007 SP1 Server. The ServiceHost is reponsible for hosting a single service endpoint: a basicHttpBinding with the following address:

http://localhost:5555/ToBlah

当我在本地计算机(Windows XP)上运行此ServiceHost时,它工作正常-当我向其中发布SOAP消息时,我返回HTTP 202代码(已接受"),这是我的正确响应服务,因为合同具有IsOneWay = true.但是,当我在2007服务器上运行此程序时,尝试调用该服务时出现503错误.我已将WCF消息日志记录一路调高",但我什么都没看到,这使我相信这是在比WCF更低的级别上发生的(呼叫永远不会到达WCF层" ).

When I run this ServiceHost on my local machine (Windows XP), it works fine - when I POST a SOAP message to it, I get back an HTTP 202 code ("Accepted"), which is the correct response for my service because the contract has IsOneWay=true. However, when I run this on my 2007 server, I get 503 errors when I try to call the service. I have the WCF message logging turned "all the way up," but I'm not seeing any logging whatsoever, which leads me to believe that this is happening at a lower level than WCF (the call never gets to the WCF "layer").

我和系统管理员已经尝试了各种形式的httpcfg命令,但到目前为止还算不上成功.

The sys-admins and I have tried various forms of httpcfg commands, but no luck so far.

我知道尝试将其托管在IIS中可能是一种可行的解决方案,但是我们的生产应用服务器未安装IIS,因此我想将服务作为ServiceHost来运行.

I know trying to host this in IIS might be a possible solution, but our production app server does not have IIS installed, so I would like to just run the service as a ServiceHost.

任何想法将不胜感激!

推荐答案

在我看来,服务器上的防火墙或其他配置设置正在阻止该端口.

It seems to me that either a firewall on the server or another configuration setting is blocking the port.

如果不是,则您的服务可能在创建ServiceHost对象实例时或在创建服务终结点时遇到错误,并且由于某种原因该错误未被捕获(?).您可以在服务代码中编写一些简单的内部测试循环,以验证是否正确创建了服务端点.这可能会揭示出一些有趣的东西.

If not, then your service may be experiencing an error during the creation of the ServiceHost object instance or during the creation of the service endpoint, and the error is for some reason not trapped(?). You could write some simple internal test loop within the service code to verify that the service endpoint was created correctly. That might reveal something interesting.

此外,从该服务器运行客户端并连接到在开发计算机上运行的服务可能还会告诉您更多信息?您可以按此处引用的方式使用WCFTestClient.exe:

Additionally, running a client from that server and connecting to your service that is running on the development machine might tell you something more? You could use WCFTestClient.exe, as referenced here: Is it possible to make the WcfTestClient work for custom transport channels?. That might give you additional information. However, you will need to support MetadataExchange (Mex) in your service in order to use that test client.

或者,您可以将Visual Studio 2008 Samples文件夹中的WCF示例与WCFTestClient.exe结合使用,以测试某些自托管且有望正常运行的服务,首先是在服务器内部,然后是外部.服务器.

Alternatively, you could use the WCF samples from the Visual Studio 2008 Samples folder, combined with WCFTestClient.exe to test some services that are self-hosted and are expected to work correctly, first within the server and then from outside of the server.

这篇关于WCF ServiceHost basicHttpBinding 503错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆