English 中文(简体)
具体列明WCF客户源港
原标题:Specify WCF client source port

我有一个以某种地址出版的WCF服务,我希望通过视频演播室生成的代理人与它联系。

I want the messages from my proxy to be sent with a specific TCP source port, but it apparently assigns a random port on each call.

The problem is this: I have two hosts A and B which are running a WCF Service (the same on each host), host A has the service up on address AdA and port PA, host B on address AdB and port PB. Host A sends a message to host B. Host B performs some internal operations after the message, and then sends a message to host A. The problem is that when Host A invokes a webmethod on B, it sends a TCP message with a random src port, and one that does not match the port on which A has the service hosted, so the webmethod is not invoked on A because the source port assigned by WCF does not match the port the service is published at.

我迄今一直在使用基本HttpBelle。

我如何能够做到这一点?

感谢。

问题回答

净吨位允许你具体说明出入境港号。

The problem is that when Host A invokes a webmethod on B, it sends a TCP message with a random src port, and one that does not match the port on which A has the service hosted, so the webmethod is not invoked on A because the source port assigned by WCF does not match the port the service is published at.

没有理由仅仅因为从另一个网络服务处收到答复而采用一种网络方法。 你们必须明确要求服务。 如果你想用A来回应A呼吁B,那么B服役守则就必须发出这一呼吁。 虽然你有两种方法,相互呼应,这只是背弃义,因此,你需要退约。 或许,如果你更详细地介绍你试图完成的工作,我可以提供更多的建议。

I don t think it is possible to assign the source port for any kind of network communication, as it has to be unique.

The source port is a next-available number assigned by TCP/IP to the client. This assigned number is how the network address translation method determines which user to send back the responses to (see NAT). Although that same client number may be used simultaneously within thousands of organizations, each TCP/IP network keeps track of its own assigned numbers for use within that network only. The combination of port number and IP address is called a "socket."

Read more: http://www.answers.com/topic/port-number#ixzz1jLxPzCVe





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签