2013-07-03 2 views
1

C# Windows 서비스 프로젝트에서 사용할 수있는 실제 WSDL 파일을 받았습니다. 웹 서비스를 호출 할 수 없습니다.

은 내가

이 프로젝트 &에 추가 된 내가 클라이언트 객체를 생성하고 클래스 전화를 관리하지만 프로젝트 폴더 안에있는 파일을 교체하고 "추가 서비스 참조"에서 추가 내가 서비스를 아래의 오류를 실행할 때

Could not find default endpoint element that references contract 'ABRECONService.ServiceIF' 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 contract could be found in the client element. 
    at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName) 
    at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration) 
    at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName) 
    at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address) 
    at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress) 
    at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory() 
    at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait) 
    at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef() 
    at System.ServiceModel.ClientBase`1..ctor() 
    at sample.eZeePayService.DateExchangeServiceIFClient..ctor() in C:\Users\Hani\Documents\Visual Studio 2010\Projects\sample\sample\Service References\ABRECONService\Reference.cs:line 32 
    at sample.ABRECONHandler.ABRECONCaller(String message) in C:\Users\Hani\Documents\Visual Studio 2010\Projects\sample\sample\ABRECONHandler.cs:line 15 

을 제기과의 app.config는 지적

<?xml version="1.0"?> 
<configuration> 
    <configSections> 
    </configSections> 
    <appSettings> 
    </appSettings> 
    <system.net> 
    <defaultProxy enabled="true" useDefaultCredentials="true"></defaultProxy> 
    </system.net> 
    <system.serviceModel> 
     <bindings> 
      <basicHttpBinding> 
       <binding name="ServiceIFBinding" 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> 
     <behaviors> 
      <serviceBehaviors> 
       <behavior name="ABRECON.MainBehavior"> 
        <serviceMetadata httpGetEnabled="true"/> 
        <serviceDebug includeExceptionDetailInFaults="false"/> 
       </behavior> 
      </serviceBehaviors> 
     </behaviors> 
     <services> 
      <service behaviorConfiguration="ABRECON.MainBehavior" name="ABRECON.Main"> 
       <endpoint address="" binding="wsHttpBinding" contract="ABRECON.IMain"> 
        <identity> 
         <dns value="localhost"/> 
        </identity> 
       </endpoint> 
       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
       <host> 
        <baseAddresses> 
         <add baseAddress="http://localhost:8732/Design_Time_Addresses/ABRECON/Main/"/> 
        </baseAddresses> 
       </host> 
      </service> 
     </services> 
    </system.serviceModel> 
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup> 
</configuration> 

입니다 웹 SERV 얼음 공급자가 다른 LAN에 있습니다 내가 뭔가를 놓친가요? 조언을 구하십시오.

답변

1

WSDL 파일에서 서비스 클래스를 작성하는 것만으로는 충분하지 않습니다. 서비스에 액세스하는 방법을 나타내는 클라이언트 구성 파일 (app.config)에 정보를 추가해야합니다.


대신 주어진 WSDL 파일에서 서비스 참조를 만드는, 직접 http://localhost:8732/Design_Time_Addresses/ABRECON/Main/에 서비스 참조 대화합니다 (MEX 프로파일의 주소)를 가리 키도록 시도 할 수 있습니다. 서비스가 실행 중인지 확인하십시오.

모든 항목이 올바르게 설정되면 해당 설정 항목이 자동으로 app.config에 추가됩니다.

0

네가 말한대로 기본 주소가 다른 LAN의 주소와 정확히 일치하므로 연결할 수 없습니다.

관련 문제