- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个客户端/服务器应用程序,我正在尝试使用我创建的 WCF 服务,但它一直抛出异常,我没能弄清楚!!
这是 WCF 服务器的代码:
<configuration>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
<services>
<service name="ChatService.ChatService"
behaviorConfiguration="behaviorConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:7997/Host/"/>
<add baseAddress="http://localhost:7998/Host/"/>
</baseAddresses>
</host>
<endpoint address="tcp"
binding="netTcpBinding"
bindingConfiguration="tcpBinding"
contract="ChatService.IChat"/>
<endpoint address="net.tcp://localhost:7996/Host/mex"
binding="mexTcpBinding"
contract="IMetadataExchange"/>
</service>
</services>
</serviceHostingEnvironment>
<behaviors>
<serviceBehaviors>
<behavior name="behaviorConfig">
<serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="tcpBinding"
maxBufferSize="67108864"
maxReceivedMessageSize="67108864"
maxBufferPoolSize="67108864"
transferMode="Buffered"
closeTimeout="00:00:10"
openTimeout="00:00:10"
receiveTimeout="00:20:00"
sendTimeout="00:01:00"
maxConnections="100">
<security mode="None">
</security>
<readerQuotas maxArrayLength="67108864"
maxBytesPerRead="67108864"
maxStringContentLength="67108864"/>
<reliableSession enabled="true" inactivityTimeout="00:20:00"/>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>
这是客户端的 WCF 服务:
<configuration>
<connectionStrings>
<add name="IClient.Properties.Settings.Co_WorkersDataBaseConnectionString"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Co-WorkersDataBase.mdb"
providerName="System.Data.OleDb" />
</connectionStrings>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IChat" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false"
transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="67108864" maxBufferSize="67108864" maxConnections="100"
maxReceivedMessageSize="67108864">
<readerQuotas maxDepth="32" maxStringContentLength="67108864" maxArrayLength="67108864"
maxBytesPerRead="67108864" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="20:00:10"
enabled="true" />
<security mode="None">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:7997/Host/tcp" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IChat" contract="CHATSERVICE.IChat"
name="NetTcpBinding_IChat" />
</client>
</system.serviceModel>
</configuration>
我想做的是与服务器建立连接,但我得到的只是这个异常!!
The Server did not provide a meaningful reply , this might be caused by a contract mismatch, a premature session shutdown or an internal server error
Server stack trace:
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IClient.CHATSERVICE.IChat.EndConnect(IAsyncResult result)
at IClient.CHATSERVICE.ChatClient.EndConnect(IAsyncResult result) in C:\Users\Desktop\IClient\Service References\CHATSERVICE\Reference.cs:line 641
at IClient.CHATSERVICE.ChatClient.OnEndConnect(IAsyncResult result) in C:\Users\Desktop\IClient\Service References\CHATSERVICE\Reference.cs:line 652
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
PS:当我点击客户端应用程序的连接按钮时,我得到了这个异常,服务器与客户端应用程序同时运行。
请帮忙!!
最佳答案
服务器上没有安全性,但客户端上的客户端凭据类型窗口具有消息安全性 - 这些需要匹配。
关于c# - 服务器未提供有意义的回复,这可能是由于契约(Contract)不匹配、 session 过早关闭或内部服务器错误造成的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9910365/
我的测试代码: int SIZE = 1900; int[][] array = new int[SIZE][]; for (int i = 0; i < SIZE; i++) { array[i
我有一堆 WAV 文件和一个将它们复制到另一个目录的脚本,但使用 SoX 处理了一些文件。输出的文件都应该有 1 个 channel ,采样率不超过 44.1khz。我的大多数文件要么有一个以上的 c
我正在运行一个相当占用内存的 Python 脚本,但似乎我的机器正在提前终止进程。我安装了 16GB(并通过 lshw -class memory 确认),但我的进程似乎在使用量达到 4GB 左右时被
我很难确定在使用 .NET 的 HttpWebRequest 类调用远程服务器(特别是 REST Web 服务)时是否有办法处理潜在的连接问题。根据我的调查,WebClient 类的行为是相同的,这在
所以我有这个网址: http://test.com/afolder/who-else-wants-to-make-horror-movies%3f/ 这是 URL 编码版本: http://test.
我是一名优秀的程序员,十分优秀!