我收到有关项目中 app.config 文件的警告,因为我使用一些不同的方法和配置将服务引用升级到了较新的版本。有没有一种方法可以生成一个新的 app.config 文件,而不必更改它的所有绑定和端点,因为那会非常累人。我想一定有办法。
这是我的 app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Apsis Newsletter Pro v3 APISoap" 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>
<customBinding>
<binding name="Apsis Newsletter Pro v3 APISoap12">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Soap12" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
<httpTransport manualAddressing="false" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
useDefaultWebProxy="true" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://api.anpdm.com/ExternalAPIService.asmx"
binding="basicHttpBinding" bindingConfiguration="Apsis Newsletter Pro v3 APISoap"
contract="Apsis5.ApsisNewsletterProv3APISoap" name="Apsis Newsletter Pro v3 APISoap" />
<endpoint address="http://api.anpdm.com/ExternalAPIService.asmx"
binding="customBinding" bindingConfiguration="Apsis Newsletter Pro v3 APISoap12"
contract="Apsis5.ApsisNewsletterProv3APISoap" name="Apsis Newsletter Pro v3 APISoap12" />
</client>
</system.serviceModel>
</configuration>
这些是警告:
警告 1:自定义工具警告:无法导入 wsdl:portType 详细信息:运行 WSDL 导入扩展时引发异常:System.ServiceModel.Description.XmlSerializerMessageContractImporter 错误:引用类型'http://schemas.xmlsoap.org/soap/encoding /:Array' 仅对编码的 SOAP 有效。错误源的 XPath://wsdl:definitions[@targetNamespace='http://api.anpdm.com/']/wsdl:portType[@name='Apsis_x0020_Newsletter_x0020_Pro_x0020_v3_x0020_APIHttpGet'] C:\Users\Pedram\Desktop\Apsis5 ( Avanza)\Apsis5\Service References\Apsis5\Reference.svcmap 1 1 Apsis5
警告 2自定义工具警告:无法导入 wsdl:binding 详细信息:导入 wsdl:binding 所依赖的 wsdl:portType 时出错。wsdl:portType 的 XPath://wsdl:definitions[@targetNamespace='http://api.anpdm.com/']/wsdl:portType[@name='Apsis_x0020_Newsletter_x0020_Pro_x0020_v3_x0020_APIHttpGet'] 错误源的 XPath://wsdl:definitions [@targetNamespace='http://api.anpdm.com/']/wsdl:binding[@name='Apsis_x0020_Newsletter_x0020_Pro_x0020_v3_x0020_APIHttpGet'] C:\Users\Pedram\Desktop\Apsis5 (Avanza)\Apsis5\Service References\Apsis5\参考.svcmap 1 1 Apsis5
警告 3自定义工具警告:无法导入 wsdl:port 详细信息:导入 wsdl:port 所依赖的 wsdl:binding 时出错。XPath 到 wsdl:binding: //wsdl:definitions[@targetNamespace='http://api.anpdm.com/']/wsdl:binding[@name='Apsis_x0020_Newsletter_x0020_Pro_x0020_v3_x0020_APIHttpGet'] XPath 到错误源: //wsdl:definitions [@targetNamespace='http://api.anpdm.com/']/wsdl:service[@name='Apsis_x0020_Newsletter_x0020_Pro_x0020_v3_x0020_API']/wsdl:port[@name='Apsis_x0020_Newsletter_x0020_Pro_x0020_v3_x0020_APIHttpDesktop'] Apsis5 (Avanza)\Apsis5\Service References\Apsis5\Reference.svcmap 1 1 Apsis5
警告 4自定义工具警告:无法导入 wsdl:portType 详细信息:运行 WSDL 导入扩展时引发异常:System.ServiceModel.Description.XmlSerializerMessageContractImporter 错误:引用类型'http://schemas.xmlsoap.org/soap/encoding/ :Array' 仅对编码的 SOAP 有效。错误源的 XPath://wsdl:definitions[@targetNamespace='http://api.anpdm.com/']/wsdl:portType[@name='Apsis_x0020_Newsletter_x0020_Pro_x0020_v3_x0020_APIHttpPost'] C:\Users\Pedram\Desktop\Apsis5 ( Avanza)\Apsis5\Service References\Apsis5\Reference.svcmap 1 1 Apsis5
警告 5自定义工具警告:无法导入 wsdl:binding 详细信息:导入 wsdl:binding 所依赖的 wsdl:portType 时出错。wsdl:portType 的 XPath://wsdl:definitions[@targetNamespace='http://api.anpdm.com/']/wsdl:portType[@name='Apsis_x0020_Newsletter_x0020_Pro_x0020_v3_x0020_APIHttpPost'] 错误源的 XPath://wsdl:definitions [@targetNamespace='http://api.anpdm.com/']/wsdl:binding[@name='Apsis_x0020_Newsletter_x0020_Pro_x0020_v3_x0020_APIHttpPost'] C:\Users\Pedram\Desktop\Apsis5 (Avanza)\Apsis5\Service References\Apsis5\参考.svcmap 1 1 Apsis5
警告 6自定义工具警告:无法导入 wsdl:port 详细信息:导入 wsdl:port 所依赖的 wsdl:binding 时出错。wsdl:binding 的 XPath://wsdl:definitions[@targetNamespace='http://api.anpdm.com/']/wsdl:binding[@name='Apsis_x0020_Newsletter_x0020_Pro_x0020_v3_x0020_APIHttpPost'] 错误源的 XPath://wsdl:definitions [@targetNamespace='http://api.anpdm.com/']/wsdl:service[@name='Apsis_x0020_Newsletter_x0020_Pro_x0020_v3_x0020_API']/wsdl:port[@name='Apsis_x0020_Newsletter_x0020_Pro_x0020_v3_x0020_APIHttpPost'P'] Apsis5 (Avanza)\Apsis5\Service References\Apsis5\Reference.svcmap 1 1 Apsis5