gpt4 book ai didi

c# - Web 服务创建实例问题 -> 找不到引用契约(Contract) 'MyWebService.ClassName' 的默认端点元素

转载 作者:太空宇宙 更新时间:2023-11-03 11:34:20 24 4
gpt4 key购买 nike

我想使用下面的 Web 服务:

https://acquirer.sb24.com/ref-payment/ws/ReferencePayment?WSDL

并在添加后构建配置文件 ->

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="PaymentIFBinding" 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="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="PaymentIFBinding1" 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="https://acquirer.sb24.com:443/ref-payment/ws/ReferencePayment"
binding="basicHttpBinding" bindingConfiguration="PaymentIFBinding"
contract="SB24Service.PaymentIF" name="PaymentIFPort" />
</client>
</system.serviceModel>
</configuration>

我想调用这个 WebService 的 verifyTransaction 方法:

PaymentIFClient pic = new PaymentIFClient();  

double pic_result = pic.verifyTransaction(str1, str2);

但第一行抛出以下错误:

Could not find default endpoint element that references contract 'SB24Service.PaymentIF' 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.

编辑:

"This error can arise if you are calling the service in a class library and calling the class library from another project." -> My Situation is like this ...

我应该更改我的配置文件什么?
提前致谢

最佳答案

手动编辑 wcf 配置很棘手,因为有许多部分需要正确并正确地相互引用。尝试在 SvcConfigEditor 中打开您的 app.config 文件(也可从 Viusal Studio 的“工具”菜单中获得)。当有 GUI 帮助做什么时,更容易让事情正确。

关于c# - Web 服务创建实例问题 -> 找不到引用契约(Contract) 'MyWebService.ClassName' 的默认端点元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6787326/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com