2012-04-13 2 views
1

웹 서비스에 VS2010/.NET 4 솔루션에 프록시를 추가했습니다. 내 컴퓨터는 Windows 7 OS입니다. 내가 지금 여기에 simlar 유형의 문제를 발견기본 끝점 요소를 찾을 수 없습니다. .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.

: 클라이언트 .NET을 구성하면이 오류가 발생하면

Could not find default endpoint element

그러나이를 통해 읽고 몇 가지 답변을 시도를 작동하지 나를 위해. "IFulfimentServiceSoap"이름 = "FulfilmentServicesSoap"/>

계약 = "FulfimentServiceSoap.FulfilmentServicesSoap"이름 = "FulfilmentServicesSoap =

계약 : 나는의 app.config 포함 여러 번 파일을 편집 한 "/>

계약 ="MYFullNamespace.FulfimentServiceSoap.FulfilmentServicesSoap "이름 ="FulfilmentServicesSoap "/>

,536,913,632 10

그러나 각각의 경우 웹 서버를 실행할 때 이벤트 뷰어는 구성 파일을 편집 할 때도 계약 'FulfimentServiceSoap.FulfilmentServicesSoap'을 표시합니다. 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> 

편집의 app.config에서 바인딩 정보를 추가했습니다.

FulfimentServiceSoap.FulfilmentServicesSoap fulfilmentServices = new FulfimentServiceSoap.FulfilmentServicesSoapClient("FulfilmentServicesSoap"); 
+0

더 많은 정보 (설정)를 게시하지 않으면 도움이되지 않습니다. – Aliostad

+0

어떤 설정을 해제할까요? –

+0

app.config, web.config ... 바인딩 설정이 필요합니다. – Aliostad

답변

1

그래, 어쨌든 이걸 알아 냈으니 다른 사람들에게 도움이 될 것입니다. 내 응용 프로그램/라이브러리 폴더에 복사 한 DLL이 만들어졌습니다. (내가 만든 app.config 파일을 복사하지 못했습니다). 클라이언트를 생성하는 코드에서 바인딩 및 끝점 주소 정보를 코딩 한 다음 SoapClient 생성자에 전달했습니다. 그래서 내 코드는 다음과 같이보고 : 당신은 셰어 기능으로의 web.config 또는의 app.config를 사용하지 않는 프로젝트를 배포하는 경우

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

, 코드 블록은 웹 또는 앱 설정을 읽을 수 없습니다 아래 예외가 발생할 수 있습니다.

웹 또는 앱 구성 항목을 조작하기 위해 웹 서비스를 호출하기 전에 아래 코드 블록을 사용할 수 있습니다.

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);