我有一个使用wsHttpBinding的WCF服务.服务器配置如下:
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)
在客户端,我包括WCF服务的服务参考.如果我的功能有限,在我的IService中说90操作合同但是如果再添加一个OperationContract而不是我无法更新服务引用,我也能添加该服务引用.在这个文章它提到,在这些配置文件仍改变这些配置文件(即devenv.exe.config,WcfTestClient.exe.config和SvcUtil.exe.config),它会工作,但即使包括那些绑定的错误弹出说
下载' http://10.0.3.112/MyService/Service1.svc/mex '时出错.请求失败,HTTP状态为400:错误请求.元数据包含无法解析的引用:' http : //10.0.3.112/MyService/Service1.svc/mex '.XML文档中存在错误(1,89549).读取XML数据时已超出最大名称字符集计数配额(16384).nametable是用于存储XML处理期间遇到的字符串的数据结构 - 具有非重复元素名称,属性名称和属性值的长XML文档可能会触发此配额.通过更改创建XML阅读器时使用的XmlDictionaryReaderQuotas对象上的MaxNameTableCharCount属性,可以增加此配额.第1行,位置89549.如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用.
不知道怎么解决这个????
在为WCF项目编写代码时,我经常遇到wsHttpBinding。但是,我从未使用过wsHttp 的 Binding。
问:wsHttp 的绑定是否甚至存在于WCF或其自定义绑定中?如果存在,那么为什么开发人员会使用wsHttp s Binding而不是wsHttpBinding?
所以我创建了Client/Server WCF.我想要的是当我从这个客户端向服务器发送消息并且因任何原因切断连接时,客户端关闭,例如,当客户端再次可用时,该客户端如何获得响应?
是否可以在客户端和服务器之间设置会话等?
我的客户代码是:
private static void Main(string[] args)
{
var client = new FlipCaseServiceClient("ReliableMessageService");
var sd = new StringData { FirstName = "Turgut", LastName = "Kançeltik" };
var fullName = client.GetFullName(ref sd);
Console.WriteLine(fullName);
}
Run Code Online (Sandbox Code Playgroud)
我的服务器代码是:
[DeliveryRequirements(RequireOrderedDelivery = true)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Single)]
public class FlipCaseService : IFlipCaseService
{
public string GetFullName(ref StringData stringData)
{
var fullName = $"{stringData.FirstName} {stringData.LastName}";
stringData.FullName = fullName;
return fullName;
}
}
Run Code Online (Sandbox Code Playgroud)
和服务器配置摘要:
<service behaviorConfiguration="ServiceBehaviorMetaData" name="FlipCaseService.FlipCaseService" >
<endpoint name="ReliableMessageService" address="flipcase/wsAddress" binding="wsHttpBinding" bindingConfiguration="BindingReliableMessaging" contract="FlipCaseService.IFlipCaseService" …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的WCF Web服务中创建第二个端点.我可以通过将域URL放在浏览器中来显示新端点的"快乐页面",因此我知道IIS可以正确地使用我的用户帐户找到该服务.
但是,如果我尝试运行调用该服务的网页,我将收到以下错误
The binding at system.serviceModel/bindings/wsHttpBinding does not have a configured
binding named 'WSHttpBinding_IMonetToDss'. This is an invalid value for
bindingConfiguration. (D:\webcontent\Monet\web.config line 178).
Run Code Online (Sandbox Code Playgroud)
由于当我创建服务引用时,Visual Studio的这一部分是由Visual Studio自动生成的,因此它的bindingConfiguration值是WSHttpBinding_IMonetToDss......它说它不应该是.
以下是从web.config中提取的两个enpoints.第一个端点/OKeeffe/OKeeffe.svc正常工作.第二个终点/OKeeffe/MonetToDss.svc是问题所在.
<client>
<endpoint address="http://insidesoap.dev.symetra.com/Escher/EscherService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IEscherService"
contract="Escher.IEscherService" name="WSHttpBinding_IEscherService" />
<endpoint address="http://insideapps.dev.symetra.com/OKeeffe/OKeeffe.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IAgentPayments"
contract="AgentPayments.IAgentPayments" name="WSHttpBinding_IAgentPayments">
<identity>
<userPrincipalName value="s.AgentData.dev" />
</identity>
</endpoint>
<endpoint address="http://insideapps.dev.symetra.com/OKeeffe/MonetToDss.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMonetToDss"
contract="MonetToDss.IMonetToDss" name="WSHttpBinding_IMonetToDss">
<identity>
<userPrincipalName value="s.AgentData.dev" />
</identity>
</endpoint>
</client>
Run Code Online (Sandbox Code Playgroud)
编辑
这是system.serviceModelWeb服务配置文件的一部分
<system.serviceModel>
<services>
<service name="OKeeffeDataService.MonetToDss"
behaviorConfiguration="MonetToDssBehaviors" > …Run Code Online (Sandbox Code Playgroud) 我有一个问题.我们正在尝试将客户端证书附加到需要SSL的WCF服务上.当我尝试通过浏览器导航到该服务时,它将向我显示"您已经创建了一个服务页面",但只有在我附加证书时,所以我不认为它是一个IIS问题.
我已经经历了大量的堆栈溢出问题,我想每次我都取得一点进展.但是对于我的生活,我无法动摇这个问题.我添加了日志记录,这是我看到的错误:
System.Net Information: 0 : [12444] SecureChannel#15775260 - Certificate
is of type X509Certificate2 and contains the private key.
System.Net Information: 0 : [12444] AcquireCredentialsHandle(package = Microsoft Unified Security Protocol Provider, intent = Outbound, scc = System.Net.SecureCredential)
System.Net Error: 0 : [12444] AcquireCredentialsHandle() failed with error 0X8009030D.
System.Net Information: 0 : [12444] AcquireCredentialsHandle(package =
Microsoft Unified Security Protocol Provider, intent = Outbound, scc = System.Net.SecureCredential)
System.Net Error: 0 : [12444] AcquireCredentialsHandle() failed with error 0X8009030D.
System.Net.Sockets Verbose: 0 : [8000] …Run Code Online (Sandbox Code Playgroud) 我使用WCF来使用一个尊重WS表单的Web服务(然后我使用WSHttpBinding绑定).此表单涉及MessageID要在soap请求的标头中设置,并且RelatesTo字段中的响应标头中存在相同的id .我想记录我与此MessageId一起发出的请求,但无法找到检索WCF设置的messageId的方法,也可以手动设置它.我设法通过设置在球场上正确的属性,但是,要求这样做,让我将它,但是从响应得到它似乎WCF覆盖它,不要让我访问新值事件已经调用了.
任何的想法 ?