- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
在成功让 WCF 服务和客户端使用 Http 相互通信后,我现在正尝试将其切换到 netTcp,以便我可以加密通信。但是,我无法根据该协议(protocol)建立连接。
更改服务上的 App.config 文件并删除客户端项目中的服务引用后,我正在尝试重新添加服务引用。单击“发现”可找到该服务,但在地址为 http://localhost:31284/MyService.svc 的 http 上这不是我在任何地方指定的地址:我认为它一定是默认地址。如果我尝试添加此服务,我会收到错误消息:
The HTML document does not contain Web service discovery information. Metadata contains a reference that cannot be resolved: 'http://localhost:31284/MyService.svc'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:31284/MyService.svc. The client and service bindings may be mismatched. The remote server returned an error: (415) Unsupported Media Type. If the service is defined in the current solution, try building the solution and adding the service reference again.
在我的应用程序配置中,我将端点地址指定为 net.tcp://localhost:8732/Design_Time_Addresses/NameSpace.ApiServices.Server/MyService。如果我将此地址放入服务引用框中并尝试连接到它或尝试使用 WCF 测试客户端进行连接,它也会失败。两者都会引发非常相似的错误:
Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:8732/Design_Time_Addresses/NameSpace.ApiServices.Server/MyService'. Could not connect to net.tcp://localhost:8732/Design_Time_Addresses/NameSpace.ApiServices.Server/MyService. The connection attempt lasted for a time span of 00:00:02.0142014. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8732. No connection could be made because the target machine actively refused it 127.0.0.1:8732 If the service is defined in the current solution, try building the solution and adding the service reference again.
不确定发生了什么。两者都在同一台机器上运行,我的防火墙已关闭。我检查了 netstat -a 并且看不到 TCP 在端口 8732 上监听,但是我已经在我的配置中打开并启用了端口共享服务。看起来像这样:
<bindings>
<netTcpBinding>
<binding portSharingEnabled="True" name="tcpBinding" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security>
<transport>
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="standard">
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceMetadata />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="NameSpace.ApiServices.Server.MyService" behaviorConfiguration="standard">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="tcpBinding" contract="NameSpace.ApiServices.Server.IMyService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8732/Design_Time_Addresses/NameSpace.ApiServices.Server/MyService/" />
</baseAddresses>
</host>
</service>
</services>
谁能看出我做错了什么?
编辑:我被要求提供我的客户端配置:
<bindings>
<netTcpBinding>
<binding name="tcpBinding" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security>
<transport>
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address=""
binding="netTcpBinding" bindingConfiguration="tcpBinding"
contract="NameSpace.Server.IUpdateCustomers" name="tcpBinding" />
</client>
</system.serviceModel>
最佳答案
好的,如果对其他人有帮助的话,终于深入了解了。 serviceMetdata 标记需要将 httpGetEnabled 属性设置为 false:
<serviceMetadata httpGetEnabled="false" />
否则,我认为,它正在尝试在 Http 和 Tcp 上启动端点并失败。
关于.net - 使用 netTCP 协议(protocol)实现 WCF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5076534/
背景: 我有一个在带有NetTCP绑定(bind)的Windows服务中托管WCF服务的系统。要将新服务添加到集合中,您只需在 services/>中添加标准WCF配置条目,然后在自定义配置部分中添加
我有一个带有 HTTP 绑定(bind)的 WCF 服务,它返回 500k 大小的数据集。使用 WCF 默认日志记录时,我可以看到消息和随每条消息传输的数据
做.NET应用开发肯定会用到网络通信,而进程间通信是客户端开发使用频率较高的场景。 进程间通信方式主要有命名管道、消息队列、共享内存、Socket通信,个人使用最多的是Sokcet相关。 而Soc
我有一个使用 nettcpBinding(框架 4.0)的 WCF 服务和客户端。客户端请求图像,服务器查找该图像并通过回调将其发送回客户端。 WCF 服务托管在 Windows 窗体应用程序中。我让
我们在为 IIS 本地托管的 WCF Web 服务配置 netTcp 时遇到问题。这是在带有 DotNet 4.0 (VS2012) 的 Windows 7 和 IIS 7 上,防火墙被禁用。 我们已
我在从客户端向 WCF net.tcp 服务发送大型 xml 时遇到问题,当调用该方法时,某些机器上的客户端会抛出内存不足异常,我无法在本地机器上重现该异常:异常消息:无法分配 33554432 字节
我正在尝试在同一网络上的多台计算机和一台服务器之间实现一些跨进程通信。我现在正在尝试的是将 WCF 与 NetTcpBinding 一起使用,托管在我在同一台机器上运行的应用程序中,但是当我尝试从另一
在尝试在 Mono 中构建客户端-服务器 WCF 应用程序时,我们遇到了一些问题。 将其简化为一个简单的示例,我们发现该服务一次仅接受一个客户端。如果另一个客户端尝试连接,它会挂起,直到第一个客户端断
我是 WCF 新手,我正在制作服务器/客户端应用程序,其中我需要一些用户/密码架构来维护每个客户端的一些自定义设置并记录谁访问该服务,但“安全”在由于信息不敏感,因此实际上并不需要通过网络的流量。因此
我有个问题。我想提供一系列使用 WCF 制作的服务。使用服务的客户端也是带有 WCF 的 .NET。我想要高速访问、快速响应、传输中小型数据契约(Contract)(主要的 .net 基本数据类型)。
我有一个没有互操作性要求的自定义 Intranet 应用程序。我们以编程方式在双工模式下构造一个 NetTcp channel 来传递消息。我们想更改消息编码,但无法弄清楚如何实现。 我们采用的方法(
我在 WCF 服务配置文件中定义了两个基地址:
所以我意识到这是一个相当沉重的问题,但这就是我想要衡量的。 我有一个服务器,它通过 WCF 接受可靠 session tcp 连接并打开到客户端的回调 channel 。 99.999%的时间,它只是
我正在编写一个 WCF 服务,需要模拟和 session 。 当我试图在我的本地机器上调用它时没问题,但在远程机器上它总是失败并出现这样的错误: Security Support Provider I
在成功让 WCF 服务和客户端使用 Http 相互通信后,我现在正尝试将其切换到 netTcp,以便我可以加密通信。但是,我无法根据该协议(protocol)建立连接。 更改服务上的 App.conf
我正在使用 WCF(使用回调契约(Contract))和 netTcpBinding 创建一个聊天应用程序。 我将该服务托管为 Windows 服务并从其他计算机访问它 通过客户端应用程序。 我现在面
我们的服务器是基于 WCF 的,它由 IIS 托管。我们使用 nettcp 作为我们的绑定(bind)。该应用程序正在运行,但我们仍然不清楚一件事:由于我们没有在配置中指定端口号,WCF/IIS 使用
我正在寻找最大值。与 netTcpBinding 一起使用的绑定(bind)的属性 maxConnections 的限制? 最佳答案 简单: Int32.MaxValue =2,147,483,64
首先,抱歉,我不流利。 我想弄清楚为什么当我们的环境具有高调用/秒率时我的 WCF 服务停止工作。我不确定仅仅增加超时时间就能解决问题。 我们有 2 个网络服务: 第一个托管在 IIS 7.5、Win
我有一个 WCF 服务。它有多个客户端和三个端点。端点绑定(bind)是 nettcp、wsHttp 和 basicHttp。如果我尝试通过 php 内置的 SoapClient 类连接到它,如下所示
我是一名优秀的程序员,十分优秀!