WebService 不会通过 ServiceReference 更新

发布于 2024-12-23 04:36:48 字数 841 浏览 5 评论 0原文

我的 Visual Studio 解决方案中有两个项目:一个是 WcfService 应用程序项目,另一个是带有 ServiceReference 的普通 C# Silverlight 项目 > 在本地访问 Web 服务。

基本上一切正常,除了 Web 服务中的更改在我的 SL 项目中不可见

例如,如果我修改某些属性在服务的 [DataContract] 类中'界面,两个项目都编译良好,但是当访问 SL 项目中的 Web 服务时,我只有修改前的状态。

在 VisualStudios ObjectBrowser 中查看 ServiceReference 会得到相同的结果:未经修改的我的 Web 服务。

我通过内置的自动“添加服务引用”将 ServiceReference 添加到了 SL 项目 em> 函数。每次修改 Web 服务时,我都会在 SL 项目中的服务参考上单击“更新服务参考”,该操作成功但没有效果。 即使删除服务引用并再次添加也不会向我显示具有已更改属性的 Web 服务。

也许是因为我几天前重命名了服务项目 - 我从解决方案中卸载了服务项目,重命名了文件系统中的文件夹,并将其作为“现有项目”再次添加到解决方案中。然后我重命名了服务文件(.svc & .svc.cs)和服务接口文件。 ==>之后,除了我无法识别的修改之外,一切似乎都工作正常?!此外,当向此服务添加 ServiceReference 时,我看到我重命名的两个文件的旧名称,而不是新名称!?

有谁知道这里发生了什么事吗? 预先感谢您阅读这个长问题;)

I have two projects in my Visual Studio solution: The one is a WcfService Application project and the other one is an ordinary C# Silverlight project with a ServiceReference to access the Web Service locally.

Basically everything works fine except the fact that changes in my Web Service are not visible in my SL project:

If i for example modify some attribute in a [DataContract] class of the service' interface, both projects compile well but the when accessing the web service in the SL project i only have the state before the modification.

Viewing the ServiceReference in the VisualStudios ObjectBrowser gives me the same result: My Web Service without modification.

I added the ServiceReference to the SL project via the in-built automatic "Add Service Reference" function. Everytime i modify the web service i click "Update Service Reference" on the Service Reference in the SL project which succeeds but without effect. Even a removal of the Service Reference and adding it again doesn't show me the web service with the altered attribute.

Maybe it's because i renamed the Service Project a few days ago - I unloaded the service project from the solution, renamed the folders in the file system and added it again as an "existing project" to the solution. Then i renamed the service file (.svc & .svc.cs) and the service interface file. ==> After that everything seems to work still fine except my unrecognized modifications ?! Also when adding a ServiceReference to this service I see the old names of the two files i renamed not the new ones !?

Does anyone has a clue what's going on here ?
Thank you in advance for reading this long question ;)

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

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

发布评论

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

评论(1

嘴硬脾气大 2024-12-30 04:36:48

解决问题的一种方法(好吧,这可能不是最好的解决方案,甚至可能是最糟糕的解决方案,但我确信它会起作用)是进行一系列清理:

  • 从 SL 项目中删除您的服务引用
  • 删除您的文件系统中与您删除的服务引用相关的所有内容(即在 SL 项目中删除相关文件/文件夹)
    目录)
  • 还可以使用记事本打开 SL csproj(或 vbproj)文件并删除与服务引用相关的行(搜索
    文件中的“服务引用”)
  • 从头开始创建一个新的 WcfService 应用程序项目,并添加所需的内容(引用、文件...),以便它反映
    当前的 WcfService 项目,您已
  • 删除旧的 WcfService 项目
  • ,编译新的 WcfService 项目,
  • 将新的 WcfService 项目作为服务引用添加到 SL 项目中。

好吧,这样做会浪费一些时间,但它会起作用。

One way to solve your problem (OK, it's probably not the best solution, even probably the worst one, but I'm sure it'll work) is to do a bunch of cleanup:

  • remove from your SL project your service reference
  • delete on your file system everything related to the service reference you deleted (i.e. drop related files/folders in SL project
    directory)
  • also open your SL csproj (or vbproj) file with notepad and delete the lines that are related to service references (search for
    "Service References" in the file)
  • create a new WcfService Application project from scratch, and add what's needed to it (references, files...) so it reflects the
    current WcfService project you have
  • delete the old WcfService project
  • compile your new WcfService project
  • add your new WcfService project as a service reference into your SL project

Okay, you'll lose some time doing this, but it'll work.

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