C# 无法从windows服务连接到WCF服务
我在远程计算机上托管了一个WCF服务。在我的本地机器上,我有一个WPF应用程序和一个windows服务,我希望能够连接到WCF服务。WPF应用程序连接和通信良好,但由于某些原因,windows服务无法连接。两者的app.config文件相同,建立连接的代码也相同。windows服务无法连接有什么原因吗 以下是我得到的一个例外: 套接字连接已中止。这可能是由于处理邮件时出错或超过了接收超时造成的 远程主机或底层网络资源问题。本地插座 超时时间为“00:01:14.9900000” 奇怪的是,异常是在5秒内抛出的,而不是在超时设置为1:15之后 以下是app.config:C# 无法从windows服务连接到WCF服务,c#,.net,windows,wcf,windows-services,C#,.net,Windows,Wcf,Windows Services,我在远程计算机上托管了一个WCF服务。在我的本地机器上,我有一个WPF应用程序和一个windows服务,我希望能够连接到WCF服务。WPF应用程序连接和通信良好,但由于某些原因,windows服务无法连接。两者的app.config文件相同,建立连接的代码也相同。windows服务无法连接有什么原因吗 以下是我得到的一个例外: 套接字连接已中止。这可能是由于处理邮件时出错或超过了接收超时造成的 远程主机或底层网络资源问题。本地插座 超时时间为“00:01:14.9900000” 奇怪的是,异常是
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="ServiceIP" value="127.0.0.1"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib" />
</assemblyBinding>
</runtime>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBindingEndpoint" closeTimeout="00:01:00"
openTimeout="00:00:10" receiveTimeout="00:10:00" sendTimeout="00:01:15"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288"
maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:8731/WCFService/" binding="netTcpBinding"
bindingConfiguration="NetTcpBindingEndpoint" contract="WCFService.IWCFService"
name="NetTcpBindingEndpoint">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
<listeners>
<add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="Traces.svclog"/>
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
据我所知,追踪似乎没有显示任何有用的信息。检查您的Windows服务运行的帐户。由于您正在访问网络资源,因此需要一个具有足够访问权限的域帐户(就像您登录的用户帐户一样)