gpt4 book ai didi

wcf - 从代码隐藏创建 WCF 绑定(bind)

转载 作者:行者123 更新时间:2023-12-02 22:30:55 26 4
gpt4 key购买 nike

我正在开发一个使用 WCF 服务的 SharePoint 工作流 - 问题是,我无法正确部署 app.config 文件。这就是我要说的:

<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:55693/Service1.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IService1" contract="ServiceReference1.IService1"
name="WSHttpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>

我无法找到如何通过代码动态设置它,有人会如此友善并为我指明正确的方向吗?

最佳答案

它就像 appconfig 一样工作:

WSHttpBinding binding = new WSHttpBinding();
binding.Name = "WSHttpBinding_IService1";
...
binding.ReaderQuotas.MaxDepth = 32;
...
binding.Security.Mode = SecurityMode.Message;
...

关于wcf - 从代码隐藏创建 WCF 绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12297921/

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