一切都可以在 WCF 中以编程方式完成还是某些功能的配置文件? [英] Can everything be done programmatically in WCF or are configuration files for certain features?

查看:19
本文介绍了一切都可以在 WCF 中以编程方式完成还是某些功能的配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常喜欢在代码中工作,利用 IntelliSense 并开放 C# 语言的所有功能以使用 WCF 但我想确保我不会朝着最终会限制我可以访问的 WCF 功能集的方向前进.我对 WCF 的经验如此有限,以至于我不明白使用配置文件的好处,尤其是如果您可以在代码中完成所有操作 (?).

I have a strong preference for working in code, leverage IntelliSense and opening up all of the power of the C# language to work with WCF but I want to make sure that I'm not moving in a direction that ultimately will limit the WCF feature set I can access. My experience is so limited with WCF that I don't understand the benefits of using the configuration files, especially if you can do everything in code (?).

注意:我使用的是 .NET 3.5.

Note: I'm using .NET 3.5.

您能否以编程方式使用 WCF 做所有事情",或者完整的 WCF 功能集是否需要配置文件?

Can you do 'everything' with WCF programmatically or are configuration files required for the full WCF feature set?

推荐答案

您可以在代码和配置中完成大约 99.8% 的事情.

You can do about 99.8% of things in code as well as config.

有些事情只能在代码中完成 - 例如在需要这两个身份验证的呼叫中设置用户名和密码.

Some things can be done only in code - like setting user name and password on a call that requires those two for authentication.

而且似乎有一些事情只能在配置中完成 - 请参阅其他 最近的 SO 问题 举个例子.

And there appear to be a few things that can be done in config only - see this other recent SO question for one example.

但我认为,如果您更喜欢代码,那么在大多数情况下应该没问题.

But I think, if you prefer code, you should be fine for the vast majority of cases.

马克

这篇关于一切都可以在 WCF 中以编程方式完成还是某些功能的配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆