在DLL中使用Web服务时出错
本文关键字:服务 出错 Web DLL | 更新日期: 2023-09-27 18:16:59
我在。net有一个web服务。我已经使用它做了一个windows窗体应用程序,但当我制作一个DLL并将其添加为我的项目的参考时,它不起作用并抛出
找不到名称为"FaturaServiceSoap"和合同为"BimsaFaturaService"的端点。FaturaServiceSoap",在服务模型客户端配置部分。
应用程序。在类库项目中配置:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="FaturaServiceSoap">
</binding>
<binding name="FaturaServiceSoap1" />
</basicHttpBinding>
<customBinding>
<binding name="FaturaServiceSoap12">
<textMessageEncoding messageVersion="Soap12" />
<httpsTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint name="FaturaServiceSoap" address="https://efaturatest.edoksis.net/FaturaService.asmx" binding="basicHttpBinding" bindingConfiguration="FaturaServiceSoap" contract="BimsaFaturaService.FaturaServiceSoap" />
<endpoint name="FaturaServiceSoap12" address="https://efaturatest.edoksis.net/FaturaService.asmx" binding="customBinding" bindingConfiguration="FaturaServiceSoap12" contract="BimsaFaturaService.FaturaServiceSoap" />
</client>
</system.serviceModel>
<startup>
<supportedRuntime version="v2.0.50727" />
</startup>
</configuration>
应用程序。在winforms应用中配置:
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/></startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="FaturaServiceSoap">
<security mode="Transport" />
</binding>
<binding name="FaturaServiceSoap1" />
</basicHttpBinding>
<customBinding>
<binding name="FaturaServiceSoap12">
<textMessageEncoding messageVersion="Soap12" />
<httpsTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://efaturatest.edoksis.net/FaturaService.asmx"
binding="basicHttpBinding" bindingConfiguration="FaturaServiceSoap"
contract="ServiceReference1.FaturaServiceSoap" name="FaturaServiceSoap" />
<endpoint address="https://efaturatest.edoksis.net/FaturaService.asmx"
binding="customBinding" bindingConfiguration="FaturaServiceSoap12"
contract="ServiceReference1.FaturaServiceSoap" name="FaturaServiceSoap12" />
</client>
</system.serviceModel>
</configuration>
我该怎么办?谢谢你的帮助!
将配置设置从类库移动到app.config中,否则它们的值将被覆盖。