简体   繁体   English

WCF服务未更新(多个项目,相同的解决方案)

[英]WCF Service Not Updating (Multi project, same solution)

I'm having a bit of trouble getting my WCF service reference from project A to reflect changes in project B. 我在从项目A获取我的WCF服务参考以反映项目B中的更改时遇到了一些麻烦。

I have both the service reference and a standard reference to the DLL of the service reference project. 我既有服务参考,也有对服务参考项目DLL的标准参考。

When making changes to the service library, these changes are not propogated, it would seem, to my client application. 对服务库进行更改时,这些更改似乎不会传播到我的客户端应用程序。 Here is an example: 这是一个例子:

This is an example of one class that I just updated with a new 'test' constructor, that resides in the service library: 这是我刚刚使用服务库中的新“测试”构造函数更新的一个类的示例:

[DataContract]
    public class TransactionUploadResult {
        [DataMember]
        public string Transaction_ID;
        [DataMember]
        public bool Error;

        public TransactionUploadResult(string id, string temp, bool error) {
            Transaction_ID = id;
            Error = error;
        }

        public override string ToString() {
            return "TID:" + Transaction_ID + ", " + (Error ? "ERROR" : "SUCCESS");
        }
    }

Notice the superfluous second parameter 'temp' in the constructor. 注意构造函数中多余的第二个参数“ temp”。

Now here is a snippet from my client code (in a different project, same solution): 现在这是我的客户代码的片段(在另一个项目中,相同的解决方案):

private void button1_Click(object sender, EventArgs e) {
            TransactionUploadResult tur = new TransactionUploadResult("test", true);
            MessageBox.Show(tur.ToString());
            MessageBox.Show(RemoteHandler.ServiceClient.UploadTransaction(new Transaction()).ToString());
        }

UploadTransaction() returns a TransactionUploadResult. UploadTransaction()返回TransactionUploadResult。 The MessageBoxes both show standard ToString() results for user-defined objects, NOT the ones I have defined in TransactionUploadResult. 消息框都显示用户定义对象的标准ToString()结果,而不是我在TransactionUploadResult中定义的结果。

The fact that the client even compiles and runs (considering it's using an outdated constructor) surprises me. 客户端甚至可以编译并运行(考虑使用了过时的构造函数)这一事实使我感到惊讶。

What's going wrong? 怎么了 Thanks in advance. 提前致谢。

我认为您必须右键单击客户端应用程序中的服务引用,然后选择“更新服务引用”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WCF使用解决方案中其他项目的服务 - WCF use service from other project in solution WCF服务命名空间colision,都在同一个解决方案中 - WCF Service namespace colision, all in same solution 无法在同一解决方案中为WCF项目的客户端类添加服务引用 - Can't add service reference to client class for WCF project within same solution 在Silverlight项目中更新WCF服务参考时出错 - Error updating WCF service reference in silverlight project 如何在同一解决方案中访问另一个项目的服务 - How to access service of another project in same solution WCF服务和Ajax调用在同一项目中 - WCF Service and ajax call in same project WCF服务参考和对同一项目的参考 - WCF Service Reference and Reference to same project 在我的网站解决方案中包含WCF服务项目并对其进行引用 - including a WCF service project in my website solution and referencing it 将 Wrapper 项目用于添加到解决方案中的多个项目的单个 WCF 服务 - Using a Wrapper project for a single WCF service added to multiple projects in a solution 从解决方案中的多个项目中使用相同的WCF服务 - Consume same WCF Service from multiple projects in solution
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM