简体   繁体   English

通过已知端口进行服务器间通信

[英]Inter-server communication via known ports

Our product system consists of an IIS 6.0 server, behind which is a Java SOA server, behind both of which is an Oracle database server. 我们的产品系统包含一个IIS 6.0服务器,后面是一个Java SOA服务器,后面是一个Oracle数据库服务器。

For various reasons, we need a windows service running on the Java SOA server that stores opaque blobs associated with GUIDs. 由于各种原因,我们需要在Java SOA服务器上运行的Windows服务,该服务存储与GUID关联的不透明blob。 Here is a simplified version of the interface: 这是界面的简化版本:

interface IBlobService
{
    void PutBlob(Guid key, byte[] data);
    byte[] GetBlob(Guid key);
}

The main user of the IBlobService is the web front-end running on the IIS server. IBlobService的主要用户是在IIS服务器上运行的Web前端。 We could use WCF or .NET remoting over a custom port for communication between the servers. 我们可以通过自定义端口使用WCF或.NET远程处理来实现服务器之间的通信。 However, our application is subject to strict accreditation requirements. 但是,我们的申请受到严格的认证要求。 We would highly prefer to use a known port for communication, rather than a custom port. 我们非常希望使用已知端口进行通信,而不是使用自定义端口。

We can't use named pipes, because we need to communicate between the servers. 我们不能使用命名管道,因为我们需要在服务器之间进行通信。 We had considered using MSMQ, as it uses a known port, but MSMQ limits message size to 4 MB. 我们考虑使用MSMQ,因为它使用已知端口,但MSMQ将消息大小限制为4 MB。 We need to transfer far more than that -- up to 60 MB at least. 我们需要转移远远超过这个 - 至少高达60 MB。

What other capabilities (if any) does .NET expose that would allow communication between servers via a known port? .NET公开了哪些其他功能(如果有的话),允许通过已知端口在服务器之间进行通信?

Well if you are using WCF you could use HTTP/HTPS. 好吧,如果你使用的是WCF,你可以使用HTTP / HTPS。 You could also use raw tcp on whatever port you like. 您也可以在任何您喜欢的端口上使用原始tcp。 eg just because port 80 is the standard http port doesn't mean you cannot run some other protocol on that port, so long as the server isn't using it already. 例如,因为端口80是标准的http端口并不意味着你不能在该端口上运行其他协议,只要服务器没有使用它。

This answer does not address the problem in the question but presents an alternative approach that avoids the problem. 这个答案没有解决问题中的问题,而是提出了一种避免问题的替代方法。

After deliberation, it is not a requirement that the blob service run as a windows service. 经过深思熟虑后,并不要求blob服务作为Windows服务运行。 Instead, a plain Java servlet that implements a RESTful interface to the data could be hosted in the Java application server. 相反,可以在Java应用程序服务器中托管实现数据的RESTful接口的普通Java servlet。 This would bypass the SOAP stack and XML overhead, yet leverage the supervisory capability of the Java application server. 这将绕过SOAP堆栈和XML开销,同时利用Java应用程序服务器的监督功能。

Data can be stored with a 数据可以用a存储

PUT https://java-app-server.example.com/blobService/b12a0403-... HTTP/1.1
Content-Length: <LENGTH OF BLOB>
Content-Type: application/octet-stream

<BLOB>

And later retrieved with a 后来用一个

GET https://java-app-server.example.com/blobService/b12a0403-... HTTP/1.1

Which returns 哪个回报

Content-Length: <LENGTH OF BLOB>
Content-Type: application/octet-stream

<BLOB>

If MSMQ is the facility of choice, I would chunk the data and reassemble it. 如果 MSMQ是首选设施,我会将数据分块并重新组装。

The contents of your message body is opaque, so including with each chunk data such as id, sequence, size, and a CRC is all possible. 消息体的内容是不透明的,因此包括每个块数据(如id,sequence,size和CRC)都是可能的。

You might want to consider WCF binary streams. 您可能需要考虑WCF二进制流。 See this article from MSDN: http://msdn.microsoft.com/en-us/library/ms733742.aspx 从MSDN查看此文章: http//msdn.microsoft.com/en-us/library/ms733742.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM