WCF SecurityNegotiationException

0

Witam,
piszę gierkę w WCF + WPF i mam problem z połączeniem klient - serwer. Mianowicie gdy tworze serwer na jednym komputerze i na tym samym tworzę klientów to klienci się łączą bez problemu z serwerem. Problem następuje gdy chcę połączyć się z serwerem z innego komputera, podczas łączenia u klientów występuje wyjątek SecurityNegotiationException

Zamieszczam fragment serwera i klientów

Server app.config

 <?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="Clarity.Battleship.Components.Server.BattleshipGameService" behaviorConfiguration="BattleshipGameServiceBehavior">
        <endpoint address="http://192.168.113.247:8088/BattleshipGameService" binding="wsDualHttpBinding" contract="Clarity.Battleship.Components.Server.IGameService" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="BattleshipGameServiceBehavior">
          <serviceThrottling maxConcurrentSessions="20" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <system.diagnostics>
    <trace autoflush="true">
      <listeners>
        <add name="fileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="trace.log" traceOutputOptions="DateTime" />
        <remove name="Default" />
      </listeners>
    </trace>
  </system.diagnostics>
  <appSettings>
    <add key="SleepTime" value="250" />
    <add key="GameTime" value="20" />
    <add key="ClientSettingsProvider.ServiceUri" value="" />
    <add key="ClientSettingsProvider.ConnectionStringName" value="DefaultConnection" />
  </appSettings>
  <system.web>
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
      <providers>
        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" connectionStringName="DefaultConnection" credentialsProvider="" />
      </providers>
    </membership>
    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
      <providers>
        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" connectionStringName="DefaultConnection" />
      </providers>
    </roleManager>
  </system.web>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source = |SQL/CE|" />
  </connectionStrings>
</configuration>

Klient app.config

 <?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <client>
      <endpoint name="Clarity.Battleship.Components.IGameService"
                address="http://192.168.113.247:8088/BattleshipGameService"
                binding="wsDualHttpBinding"
                bindingConfiguration="BattleshipBinding"
                contract="Clarity.Battleship.Components.Server.IGameService" />
    </client>
    <bindings>
      <!-- configure a binding that support duplex communication -->
      <wsDualHttpBinding>
        <binding name="BattleshipBinding"
                 clientBaseAddress="http://localhost:6088/BattleshipGameClient/">
        </binding>
      </wsDualHttpBinding>
    </bindings>
  </system.serviceModel>
</configuration>

Będę wdzięczny za pomoc.

1

Ekspert od WCF zemnie żaden ale na pierwszy rzut oka wydaje mi się że zapomniałeś zdefiniować "Security Mode".
http://msdn.microsoft.com/en-us/library/ms731925.aspx

0

Dorzuciłem do serwera:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
    <bindings>

      <wsHttpBinding>

        <binding name="BattleshipBinding">

          <security mode="None">
          </security>

        </binding>

      </wsHttpBinding>

    </bindings>

    <services>
      <service name="Clarity.Battleship.Components.Server.BattleshipGameService" behaviorConfiguration="BattleshipGameServiceBehavior">
        <endpoint address="http://192.168.113.247:8088/BattleshipGameService" binding="wsDualHttpBinding" contract="Clarity.Battleship.Components.Server.IGameService" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="BattleshipGameServiceBehavior">
          <serviceThrottling maxConcurrentSessions="20" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <system.diagnostics>
    <trace autoflush="true">
      <listeners>
        <add name="fileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="trace.log" traceOutputOptions="DateTime" />
        <remove name="Default" />
      </listeners>
    </trace>
  </system.diagnostics>
  <appSettings>
    <add key="SleepTime" value="250" />
    <add key="GameTime" value="20" />
    <add key="ClientSettingsProvider.ServiceUri" value="" />
    <add key="ClientSettingsProvider.ConnectionStringName" value="DefaultConnection" />
  </appSettings>
  <system.web>
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
      <providers>
        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" connectionStringName="DefaultConnection" credentialsProvider="" />
      </providers>
    </membership>
    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
      <providers>
        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" connectionStringName="DefaultConnection" />
      </providers>
    </roleManager>
  </system.web>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source = |SQL/CE|" />
  </connectionStrings>
</configuration> 

i do klienta

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <client>
      <endpoint name="Clarity.Battleship.Components.IGameService"
                address="http://192.168.113.247:8088/BattleshipGameService"
                binding="wsDualHttpBinding"
                bindingConfiguration="BattleshipBinding"
                contract="Clarity.Battleship.Components.Server.IGameService" />
    </client>
    <bindings>
      <!-- configure a binding that support duplex communication -->
      <wsDualHttpBinding>
        <binding name="BattleshipBinding"
                 clientBaseAddress="http://localhost:6088/BattleshipGameClient/">
          <security mode="None" />
        </binding>
      </wsDualHttpBinding>
    </bindings>
  </system.serviceModel>
</configuration> 

teraz wyskakuje mi TimeoutException

dodałem

System.Net.ServicePointManager.DefaultConnectionLimit = 400; 

ale nadal nic to nie zmieniło i wywala TimeoutException

0

Serwer: http://192.168.113.247:8088/BattleshipGameService
Klient: http://192.168.113.247:8088/BattleshipGameService

skoro to dwa różne kompy nie powinny być różne IP ? :P</del>

Zaćmienie umysłu.

0

Hm to co mam wpisać w kliencie?
bo w kliencie podaje adres komputera który ma serwer.

a w adresie serwera wpisuje adres komputera :)

robię coś źle?

0

Spróbuj jeszcze tego: http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,af6e6325-2e30-42e3-acb9-57e1363fa51e.aspx
Jak to nie pomoże to moje pomysły się skończyły. :P Może ktoś bardziej obeznany się wypowie. :)

0

To też nie pomogło, jakieś inne pomysły, jak coś mogę udostępnić cały kod jeżeli ktoś potrzebuje więcej informacji.

1 użytkowników online, w tym zalogowanych: 0, gości: 1