WCF Problem
Geizhals » Forum » Software » WCF Problem (28 Beiträge, 288 Mal gelesen) Top-100 | Fresh-100
Du bist nicht angemeldet. [ Login/Registrieren ]
WCF Problem
26.06.2008, 10:33:19
Schönen Tag.
So mein Problem besteht darin das ich in C# per WCF einen Webdienst zur Verfügung stellen will mit dem dann ein anderer Rechner über das Netz zugreifen kann (lokal geht es schon). Ich hab mir die Klassen für den Client vom svcutil übersetzen lassen. Wenn ich jetzt jedoch das Service vom anderen Rechner aufrufe kommt immer folgende Fehlermeldung:

Unhandled Exception: System.ServiceModel.EndpointNotFoundException: Could not connect to http://XXX.XXX.XXX.XXX
:8000/ServiceModelSamples/Service/CalculatorService. TCP error code 10061: No connection could be made because
the target machine actively refused it XXX.XXX.XXX.XXX:8000.  ---> System.Net.WebException: Unable to connect
to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target m
achine actively refused it XXX.XXX.XXX.XXX:8000
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& sock
et, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception

Das sagt soviel wie das der Server mir den Zugriff verweigert.
Ich hab nachgelesen das das etwas mit den Security-Einstellungen zu tun hat jedoch hab ich sowohl beim Server als auch beim Client die Security auf "none" gesetzt jedoch kommt noch immer der Fehler.

Konfiguration Server:

Uri baseAddress = new Uri("http://localhost:8000/ServiceModelSamples/Service");

ServiceHost selfHost = new ServiceHost(typeof(CalculatorService), baseAddress);

WSHttpBinding binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.None;

selfHost.AddServiceEndpoint(typeof(ICalc),new WSHttpBinding(),"CalculatorService");
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
selfHost.Description.Behaviors.Add(smb);

selfHost.Open();

App.config vom Client:

#?xml version="1.0" encoding="utf-8"?#
#configuration#
    #system.serviceModel#
        #bindings#
            #wsHttpBinding#
                #binding name="WSHttpBinding_ICalc" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
                    transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false"#
                    
                    #reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" /#
                    #security mode="None"#
                        #transport clientCredentialType="Windows" proxyCredentialType="None"
                            realm="" /#
                        #message clientCredentialType="Windows" negotiateServiceCredential="true"
                            algorithmSuite="Default" establishSecurityContext="true" /#
                    #/security#
                #/binding#
            #/wsHttpBinding#
        #/bindings#
        #client#
            #endpoint address="http://XXX.XXX.XXX.XXX:8000/ServiceModelSamples/Service/CalculatorService"
                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICalc"
                contract="ICalc" name="WSHttpBinding_ICalc"#
                #identity#
                    #userPrincipalName value="XXXXXX" /#
                #/identity#
            #/endpoint#
        #/client#
    #/system.serviceModel#
#/configuration#

Hab die eckigen Klammern mit ner Raute ersetzt weil sonst kann er die Sachen was in den KLammern stehen nicht anzeigen.

Würd mich um Hilfe freuen!!

mfg Mimu

26.06.2008, 10:48 Uhr - Editiert von Mimu, alte Version: hier
Antworten PM Übersicht Chronologisch
 
Melden nicht möglich
....
Re(4): WCF Problem
27.06.2008, 12:24:01
So ich hab jetzt für den Server auch eine app.config gemacht. Hab jetzt bei beiden die Security weggelassen jedoch bekomm ich jetzt diese Fehlermeldung.

Unhandled Exception: System.ServiceModel.Security.SecurityNegotiationException: The caller was not authenticat
ed by the service. ---> System.ServiceModel.FaultException: The request for security token could not be satisf
ied because authentication failed.
   at System.ServiceModel.Security.SecurityUtils.ThrowIfNegotiationFault(Message message, EndpointAddress targ
et)
   at System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody(Message incomingMes
sage, SspiNegotiationTokenProviderState sspiState)

Config-File vom Server:

#?xml version="1.0" encoding="utf-8"?#
#configuration#
    #system.diagnostics /#
    #system.serviceModel#
      #behaviors#
       #serviceBehaviors#
          #behavior name="Test"#
            #serviceMetadata httpGetEnabled="true"/#
          #/behavior#
        #/serviceBehaviors#
      #/behaviors#
        #bindings#
            #wsHttpBinding#
                #binding name="WSHttpBinding_ICalculator"  closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false"#
                    #readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" /#
                    #reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" /#
                   #!----#
                #/binding#
           #/wsHttpBinding#
        #/bindings#
        #services#
          #service behaviorConfiguration="Test" name="CalculatorService"#
            #endpoint address="http://localhost:8000/ServiceModelSamples/Service/CalculatorService"
                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICalculator"
                contract="ICalculator" name="WSHttpBinding_ICalculator"#
                #!--
                    --#
            #/endpoint#
          #/service#
        #/services#
    #/system.serviceModel#
#/configuration#

Config-File vom Client:
#?xml version="1.0" encoding="utf-8"?#
#configuration#
    #system.serviceModel#
        #bindings#
            #wsHttpBinding#
                #binding name="WSHttpBinding_ICalculator" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false"#
                    #readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" /#
                    #reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" /#
                    #!--#security mode="Message"#
                        #transport clientCredentialType="Windows" proxyCredentialType="None"
                            realm="" /#
                        #message clientCredentialType="Windows" negotiateServiceCredential="true"
                            algorithmSuite="Default" establishSecurityContext="true" /#
                    #/security#--#
                #/binding#
            #/wsHttpBinding#
        #/bindings#
        #client#
            #endpoint address="http://145.241.17.153:8000/ServiceModelSamples/Service/CalculatorService"
                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICalculator"
                contract="ICalculator" name="WSHttpBinding_ICalculator"#
            #/endpoint#
        #/client#
    #/system.serviceModel#
#/configuration#

Also mir sagt die Fehlermeldung soviel wie das er sich nicht erfolgreich authentifizieren hat können, aber wieso sollte der sich authentifizieren müssen wenn ich überhaupt nichts bei den Securitys eingestellt hab??

Bitte um Hilfe
mfg Mimu

Antworten PM Übersicht Chronologisch Zum Vorgänger
 
Melden nicht möglich
..........
Re(10): WCF Problem
27.06.2008, 13:24:51
Nein ich habs auf beiden Seiten gemacht und im Code setz ich ganz sicher nirgends wo die security.

Gerne nochmal beide app.config:

Server:

#?xml version="1.0" encoding="utf-8"?#
#configuration#
    #system.diagnostics /#
    #system.serviceModel#
      #behaviors#
        #serviceBehaviors#
          #behavior name="Test"#
            #serviceMetadata httpGetEnabled="true"/#
          #/behavior#
        #/serviceBehaviors#
      #/behaviors#
        #bindings#
            #wsHttpBinding#
              #binding name="WSHttpBinding_ICalculator"#
                #security mode="None"#
                  #transport clientCredentialType="None" /#
                  #message clientCredentialType="None" /#
                #/security#
              #/binding#
            #/wsHttpBinding#
        #/bindings#
        #services#
          #service behaviorConfiguration="Test" name="CalculatorService"#
            #endpoint address="http://localhost:8000/ServiceModelSamples/Service/CalculatorService"
                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICalculator"
                contract="ICalculator" name="WSHttpBinding_ICalculator"#
            #/endpoint#
          #/service#
        #/services#
    #/system.serviceModel#
#/configuration#

Client:

#?xml version="1.0" encoding="utf-8"?#
#configuration#
    #system.serviceModel#
        #bindings#
            #wsHttpBinding#
              #binding name="WSHttpBinding_ICalculator"#
                #security mode="None"#
                  #transport clientCredentialType="None" /#
                  #message clientCredentialType="None" /#
                #/security#
              #/binding#
            #/wsHttpBinding#
        #/bindings#
        #client#
            #endpoint address="http://145.241.17.153:8000/ServiceModelSamples/Service/CalculatorService"
                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICalculator"
                contract="ICalculator" name="WSHttpBinding_ICalculator"#
            #/endpoint#
        #/client#
    #/system.serviceModel#
#/configuration#

Antworten PM Übersicht Chronologisch Zum Vorgänger
 
Melden nicht möglich
 

Dieses Forum ist eine frei zugängliche Diskussionsplattform.
Der Betreiber übernimmt keine Verantwortung für den Inhalt der Beiträge und behält sich das Recht vor, Beiträge mit rechtswidrigem oder anstößigem Inhalt zu löschen.
Datenschutzerklärung