gpt4 book ai didi

.net - 在Message.CreateMessage中, "action"参数是什么意思?

转载 作者:行者123 更新时间:2023-12-03 23:53:52 24 4
gpt4 key购买 nike

这是交易:

public static Message CreateMessage(
MessageVersion version,
MessageFault fault,
string action)

action: A description of how the message should be processed.



你们在里面放什么? “小心轻放!!!”还是“脆弱”?最后有什么不同吗?

最佳答案

“Action”是消息头中的字符串之一。

例如,这个调用

        var m = Message.CreateMessage(MessageVersion.Default, "http://tempuri.org/MyMethod");

产生此消息
<s:Envelope
xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<a:Action s:mustUnderstand="1">http://tempuri.org/MyMethod</a:Action>
</s:Header> <s:Body />
</s:Envelope>

每条消息都有一个“action” header ,每个 WCF 操作都有一个“action”属性。 WCF 系统将在确定将每条消息分派(dispatch)到哪个操作时比较这些值。

通常,您不会手动生成消息,因此您不必担心这一点 - 默认值会按预期进行处理。

当您定义服务契约时,您可以显式地将操作字符串与操作关联:
[ServiceContract]
interface MyService
{
[OperationContract(Action="http://tempuri.org/MyMethod")]
void ThisIsntReallyCalledMyMethod(string parameter1);
}

关于.net - 在Message.CreateMessage中, "action"参数是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3603015/

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