将 WCF 服务从 .NET 3.5 升级到 4.0 是否会更改合同?

发布于 2024-09-18 06:29:08 字数 1654 浏览 3 评论 0原文

如果我将 WCF Web 服务从 .NET 3.5 升级到 4.0,而不进行其他更改,是否存在暴露给外界的合同更改的风险? IE。我的消费者是否需要重新使用 WSDL?

如果是这样,我能做些什么来阻止这种情况发生吗?

编辑:我正在谈论的此类事情的一个例子。

我们已经使用这样的东西有一段时间了 http://www.codeproject.com/KB/aspnet/WSSecurityProvider.aspx

我可能读错了,但是当我升级服务器并从客户端重新使用时,Reference.cs 发生了更改,因此

public MyNamespace.MembershipUser RemoteMembershipProvider_CreateUser(out System.Web.Security.MembershipCreateStatus status, string providerName, string applicationName, string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey) {
    return base.Channel.RemoteMembershipProvider_CreateUser(out status, providerName, applicationName, username, password, email, passwordQuestion, passwordAnswer, isApproved, providerUserKey);
}

更改为

public MyNamespace.MembershipUser RemoteMembershipProvider_CreateUser(out MyNamespace.MembershipCreateStatus status, string providerName, string applicationName, string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey) {
    return base.Channel.RemoteMembershipProvider_CreateUser(out status, providerName, applicationName, username, password, email, passwordQuestion, passwordAnswer, isApproved, providerUserKey);
}

“注意 MembershipCreateStatus 的命名空间中的更改”。

(不,我真的没有一个名为 MyNamespace 的命名空间)

我是否错误地认为如果我没有重新使用,它就会停止工作?

如果没有,具体发生的变化是什么?它会影响多少其他案例?只是框架枚举?或者还不止这些?

If I upgrade a WCF Web Service from .NET 3.5 to 4.0, making no other changes, is there any risk of a change to the contract exposed to the outside world? ie. Will my consumers need to reconsume the WSDL?

If so, is there anything I can do to stop that happening?

EDIT: An example of the kind of thing I'm talking about.

We have been using something like this for a while
http://www.codeproject.com/KB/aspnet/WSSecurityProvider.aspx

I may be reading this wrong but when I upgraded the server and reconsumed from the client, the Reference.cs changed so that

public MyNamespace.MembershipUser RemoteMembershipProvider_CreateUser(out System.Web.Security.MembershipCreateStatus status, string providerName, string applicationName, string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey) {
    return base.Channel.RemoteMembershipProvider_CreateUser(out status, providerName, applicationName, username, password, email, passwordQuestion, passwordAnswer, isApproved, providerUserKey);
}

changed to

public MyNamespace.MembershipUser RemoteMembershipProvider_CreateUser(out MyNamespace.MembershipCreateStatus status, string providerName, string applicationName, string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey) {
    return base.Channel.RemoteMembershipProvider_CreateUser(out status, providerName, applicationName, username, password, email, passwordQuestion, passwordAnswer, isApproved, providerUserKey);
}

Note the change in namespace for MembershipCreateStatus.

(and no, I don't really have a namespace called MyNamespace)

Am I wrong in thinking that if I hadn't reconsumed, it would have stopped working?

And if not, what is the specific thing that has change and how many other cases will it effect? Just framework enums? Or more than that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁把谁当真 2024-09-25 06:29:08

不,不应该有任何问题 - 毕竟,客户端和服务器之间传输的只是序列化消息。

客户端实际上并不关心服务器使用的操作系统或 .NET 版本 - 只要消息可以被理解和解释即可。

只要不做任何改变,就应该没问题!

No, there shouldn't be any issues - after all, all that travels between the client and the server is the serialized message.

The client really doesn't care what OS or .NET version the server is on - as long as the message can be understood and interpreted.

As long as you don't change anything, you should be just fine!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文