Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在DLL中使用Web服务时出错_C#_Winforms_Web Services - Fatal编程技术网

C# 在DLL中使用Web服务时出错

C# 在DLL中使用Web服务时出错,c#,winforms,web-services,C#,Winforms,Web Services,我在.net中有一个web服务。我已经用它制作了一个windows窗体应用程序,但当我制作一个DLL并将其添加为项目的引用时,它不起作用并抛出 在服务模型客户端配置部分中找不到名为“FaturaServiceSoap”且约定为“BimSafaturasService.FaturaServiceSoap”的终结点 类库项目中的app.config: <?xml version="1.0"?> <configuration> <system.serviceModel

我在.net中有一个web服务。我已经用它制作了一个windows窗体应用程序,但当我制作一个DLL并将其添加为项目的引用时,它不起作用并抛出

在服务模型客户端配置部分中找不到名为“FaturaServiceSoap”且约定为“BimSafaturasService.FaturaServiceSoap”的终结点

类库项目中的app.config:

<?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应用程序中的app.config:

<?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,因为它们的值会被覆盖

将配置设置从类库移动到app.config,因为它们的值会被覆盖

您应该将端点配置添加到使用类库的项目的app.config中。这是因为项目不会使用类库的app.config。您应该将端点配置添加到使用类库的项目的app.config中。这是因为项目不会使用类库的app.config。