Lan通信无法正常工作,Wcf Client / Server APP

时间:2015-04-24 19:15:58

标签: c# wcf network-programming

我必须制作聊天应用程序, 但我无法与局域网中的其他计算机通信。 我收到了错误

  

发生了System.Service.Model.SecurityNegotiationException   mscorlib.dll ///服务器已拒绝客户端凭据。

我正在尝试与其他客户沟通。我认为安全是问题所在。但我无法在这些.config文件中看到错误:

Server App.config

<?xml version="1.0" encoding="utf-8"?>
        <configuration>
          <configSections>

            <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
          <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
          <startup>
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
          </startup>
          <connectionStrings>
            <add name="EFContext" connectionString="server=SEPTIKUZS004; database=Tema2  ; integrated security=SSPI;MultipleActiveResultSets=true;" providerName="System.Data.SqlClient" />
          </connectionStrings>
          <system.serviceModel>
            <bindings>
              <netTcpBinding>
                <binding name="NetTcpBinding_IMessage" 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="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="None">
                    <transport clientCredentialType="None" protectionLevel="None" />
                    <message clientCredentialType="None" />
                  </security>
                </binding>
              </netTcpBinding>
            </bindings>
            <services>
              <service name="ChattingServ.Service1">
                <endpoint address="net.tcp://192.168.1.106:9000/ChattingService" binding="netTcpBinding" bindingConfiguration="" name="ChattingServiceEndPoint" contract="ChattingInerfaces.IService1" />
              </service>
            </services>
          </system.serviceModel>
          <entityFramework>
            <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
            <providers>
              <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
            </providers>
          </entityFramework>
        </configuration>

客户端App.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpBinding_IMessage" 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="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="None">
            <transport clientCredentialType="None" protectionLevel="None" />
            <message clientCredentialType="None" />
          </security>          
        </binding>
      </netTcpBinding>
    </bindings>
    <client>
      <!--      <endpoint address="net.tcp://localhost:9191/WCFCallbacks/Message" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IMessage" contract="IMessage" name="NetTcpBinding_IMessage">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>-->

        <endpoint address="net.tcp://192.168.1.106:9000/ChattingService" binding="netTcpBinding" bindingConfiguration="" contract="ChattingInerfaces.IService1" name="ChattingServiceEndPoint" kind="" endpointConfiguration="" />
    </client>
  </system.serviceModel>
  <connectionStrings>
    <add name="ModelCuEF6" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(local);initial catalog=Tema3;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>

0 个答案:

没有答案