我需要将以下 app.config 部分转换为代码。我已经看过几个例子,但仍然不能让它发挥作用。有人可以帮忙吗?
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MyService"
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="TransportWithMessageCredential">
<transport clientCredentialType="None"
proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName"
algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://server.com/service/MyService.asmx"
binding="basicHttpBinding" bindingConfiguration="MyService"
contract="MyService.MyServiceInterface"
name="MyService" />
</client>
</system.serviceModel>
我的用例是我正在编写一个将由其他非.net 应用程序使用的 dll,因此我没有放置 app.config 的好地方。
谢谢!