Visual Studio Web 参考中的 URL 行为
请有人准确解释一下 Visual Studio 中 Web 引用的 URL 行为(静态或动态)属性的用途。
我相信它会影响 Web 服务的 URl 的存储位置,但我没有清楚的理解。
Please can some one explain exactly what the URL Behaviour (Static or Dynamic) property for a Web Reference in Visual Studio is for.
I believe it affects where the URl for the Web Service is stored but I don't have a clear understanding.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是更完整的答案。
动态会自动添加指定 Web 服务 URL 的设置。是的,可以通过
app.config
进行管理,但该设置必须位于
下app.config
的特定位置。Static 使代理的构造函数将
Url
属性初始化为其原始值。因此,如果您有自己的 URL 处理(例如,从数据库检索 URL 或驻留在
app.config
的另一部分中),URL 行为
必须是静态
并稍后在您的自定义代码中进行更改。Here's a bit more complete answer.
Dynamic automatically adds a setting that specifies Web Service URL. Yes, it can be managed through
app.config
, but the setting must reside in a specific place ofapp.config
under<applicationSettings>
.Static makes the proxy's constructor to initialize
Url
property to its original value.So if you have your own URL handling (e.g. the URL is retrieved from the database or resides in another section of
app.config
),URL Behaviour
must beStatic
and changed later in your custom code.这是正确的。
如果将其设置为动态,之后您可以更改 Web 服务的 url (WebService.Url)。 详细信息。
That's right.
If you set it to dynamic, afterwards you can change url of web service (WebService.Url). Details here.