웹 서비스 호출 오류, "해당 계약에 대해 둘 이상의 엔드 포인트 구성"또는 "엔드 포인트 수신 없음"

user3475113

웹 서비스 추가에 대한이 스레드 오류에서 해결 된 웹 서비스를 추가하는 데 문제 가 발생했습니다.

이제 메서드를 호출하여 문제가 있습니다.

이것은 내 app.config입니다.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="sedardIPSoap" />
        </basicHttpBinding>
        <customBinding>
            <binding name="sedardIPSoap12">
                <textMessageEncoding messageVersion="Soap12" />
                <httpTransport />
            </binding>
        </customBinding>
    </bindings>
    <client>
        <endpoint address="http://service.proapp.ir/service/sedardIP.asmx"
            binding="basicHttpBinding" bindingConfiguration="sedardIPSoap"
            contract="sedardip_set.sedardIPSoap" name="sedardIPSoap" />
        <endpoint address="http://service.proapp.ir/service/sedardIP.asmx"
            binding="customBinding" bindingConfiguration="sedardIPSoap12"
            contract="sedardip_set.sedardIPSoap" name="sedardIPSoap12" />
    </client>
</system.serviceModel>

그래서 이렇게 내 함수를 호출 할 때

sedardip_set.sedardIPSoapClient nm = new sedardip_set.sedardIPSoapClient();
nm.set_ip("x1", "x2", "x3");

이 예외가 발생합니다.

An endpoint configuration section for contract 'sedardip_set.sedardIPSoap' 
could not be loaded because more than one endpoint configuration for that 
contract was found. Please indicate the preferred endpoint configuration 
section by name.

그래서 app.config에서 끝점 중 하나를 삭제하려고 시도한 후이 예외가 발생했습니다.

There was no endpoint listening at http://service.proapp.ir/service/sedardIP.asmx 
that could accept the message. This is often caused by an incorrect address or 
SOAP action. See InnerException, if present, for more details.

내부 예외

{"The remote server returned an error: (404) Not Found."}

내 Visual Studio에서 (로컬로) 서비스를 실행하고 두 번째 끝점을 삭제하면 방금 작동했습니다! 그래서 누구나 plz이 http://service.proapp.ir/service/sedardIP.asmx plz에서 작동하도록 도와 줄 수 있습니까 ??

Him_Jalpert

웹 참조를 사용해야하는 이유가 있습니까? 서비스 참조는 업데이트 된 최신 방식이지만 어떤 이유로 웹 참조를 사용해야하는 경우에도 괜찮습니다.

서비스 참조 경로로 이동하면 사용할 엔드 포인트의 이름을 구체적으로 지정할 수 있습니다. 예를 들면 다음과 같습니다.

sedardip_set.sedardIPSoapClient nm = new sedardip_set.sedardIPSoapClient("sedardIPSoap12");
nm.set_ip("x1", "x2", "x3");

서비스 참조를 설정 한 후 새 이름을 가질 수 있지만 sedardIPSoap12 대신 새 이름으로 대체하면됩니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관