2012-04-13 14 views
1

Ich habe einen Proxy zu einem Webservice zu einer VS2010/.NET 4solution hinzugefügt. Meine Maschine ist Windows 7 OS. Bei der Konstruktion des Client .NET diesen Fehler führt:Das Standardendpunktelement konnte nicht gefunden werden. .NET 4.0

Could not find endpoint element with name 'FulfilmentServicesSoap' and contract 'FulfimentServiceSoap.FulfilmentServicesSoap' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.

ich auf SO hier eine simlar Typ Frage gefunden haben:

Could not find default endpoint element

jedoch durch diese zu lesen und einige der Antworten versucht hat nicht funktioniert für mich. Ich habe die app.config einige Male einschließlich Datei bearbeitet:

Vertrag = "IFulfimentServiceSoap" name = "FulfilmentServicesSoap" />

und

Vertrag = "FulfimentServiceSoap.FulfilmentServicesSoap" name = "FulfilmentServicesSoap "/>

und

Vertrag =" MYFullNamespace.FulfimentServiceSoap.FulfilmentServicesSoap“name = "FulfilmentServicesSoap"/>

Aber in jedem Fall, wenn ich meinen Web-Service betreibe, zeigt der Event-Viewer den Vertrag 'FulfimentServiceSoap.FulfilmentServicesSoap' an, auch wenn ich die Konfigurationsdatei bearbeitet habe. Gibt es noch etwas, was ich tun muss, um die Änderungen in der Datei app.config zu übernehmen oder hat jemand andere Ideen?

EDIT - added Bindung Informationen von app.config

<system.serviceModel> 
     <bindings> 
      <basicHttpBinding> 
       <binding name="FulfilmentServicesSoap" closeTimeout="00:01:00" 
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
        maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
        useDefaultWebProxy="true"> 
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
         maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
        <security mode="None"> 
         <transport clientCredentialType="None" proxyCredentialType="None" 
          realm="" /> 
         <message clientCredentialType="UserName" algorithmSuite="Default" /> 
        </security> 
       </binding> 
      </basicHttpBinding> 
     </bindings> 
     <client> 
      <endpoint address="http://localhost/WLR3.Web.services/FulfilmentServices.asmx" 
       binding="basicHttpBinding" bindingConfiguration="FulfilmentServicesSoap" 
       contract="FulfimentServiceSoap.FulfilmentServicesSoap"name="FulfilmentServicesSoap" /> 
     </client> 
    </system.serviceModel> 

EDIT - Code, in dem Client erstellt wird.

+0

Ohne einige weitere Informationen (Config), schwer zu helfen. – Aliostad

+0

welcher Typ von Config? –

+0

Ihre app.config, web.config ... benötigen verbindliche Konfiguration. – Aliostad

Antwort

1

Ok, das habe ich sowieso herausgefunden - wird hier posten, falls es jemand anderem hilft. Die DLL wurde erstellt und in meinen Ordner "Programme/Bibliotheken" kopiert. (Ich habe die app.config-Datei, die erstellt wurde, nicht kopiert). In dem Code, in dem ich den Client erstelle, habe ich die Details der Bindungs- und Endpunktadresse codiert und dann an den SoapClient-Konstruktor übergeben. Also mein Code für das sah wie folgt:

BasicHttpBinding binding = new BasicHttpBinding(); 
      EndpointAddress remoteAddress = new EndpointAddress("http://localhost/WLR3.Web.services/FulfilmentServices.asmx"); 
      binding.Name = "FulfilmentServicesSoap"; 
      binding.AllowCookies = false; 

      FulfimentServiceSoap.FulfilmentServicesSoap fulfilmentServices = new FulfimentServiceSoap.FulfilmentServicesSoapClient(binding, remoteAddress); 
2

Wenn Sie ein Projekt bereitstellen, die nicht web.config oder app.config nicht verwendet wie Sharepoint-Feature, Code-Block nicht Web oder App Config lesen und Unter Ausnahme kann auftreten.

Sie können den folgenden Codeblock verwenden, bevor Sie Ihren Webservice aufrufen, um Web- oder App-Konfigurationseinträge zu bearbeiten.

BasicHttpBinding httpBinding = new BasicHttpBinding(); 
httpBinding.Name = "DMS_WSSoap"; 
httpBinding.CloseTimeout = new TimeSpan(0, 1, 0); 
httpBinding.OpenTimeout = new TimeSpan(0, 1, 0); 
httpBinding.ReceiveTimeout = new TimeSpan(0, 10, 0); 
httpBinding.SendTimeout = new TimeSpan(0, 1, 0); 
httpBinding.AllowCookies = false; 
httpBinding.BypassProxyOnLocal = false; 
httpBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard; 
httpBinding.MaxBufferSize = 65536; 
httpBinding.MaxBufferPoolSize = 524288; 
httpBinding.MaxReceivedMessageSize = 65536; 
httpBinding.MessageEncoding = WSMessageEncoding.Text; 
httpBinding.TextEncoding = Encoding.UTF8; 
httpBinding.TransferMode = TransferMode.Buffered; 
httpBinding.UseDefaultWebProxy = true; 

httpBinding.ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas(); 
httpBinding.ReaderQuotas.MaxDepth = 32; 
httpBinding.ReaderQuotas.MaxStringContentLength = 8192; 
httpBinding.ReaderQuotas.MaxArrayLength = 16384; 
httpBinding.ReaderQuotas.MaxBytesPerRead = 4096; 
httpBinding.ReaderQuotas.MaxNameTableCharCount =16384; 

httpBinding.Security.Mode = BasicHttpSecurityMode.None; 
httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; 
httpBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None; 
httpBinding.Security.Transport.Realm = ""; 
httpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; 

//The url of web services. 
EndpointAddress endpoint = new EndpointAddress("http://localhost/_layouts/DMS_WS/DMS_WS.asmx"); 

//one of the example web service which has been referenced in visual studio IDE. 
LibraryWatcherWebService.DMS_WSSoapClient lservice = new LibraryWatcherWebService.DMS_WSSoapClient(httpBinding, endpoint); 
Verwandte Themen