如何摆脱“目标程序集不包含任何服务类型”错误消息在VS2008? [英] How can I get rid of the "The target assembly contains no service types" error message in VS2008?

查看:472
本文介绍了如何摆脱“目标程序集不包含任何服务类型”错误消息在VS2008?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户端/服务器wcf应用程序



我的可执行文件没有定义任何 ServiceContract 它甚至没有引用 System.ServiceModel 而是引用包含服务器的连接逻辑的程序集



我有另一个程序集,由我的EXE引用,其中包含一个 ServiceContract



它以前工作正常。昨天,我已经使用我的项目设置(部分信任,完全信任,部署设置等等)玩了很多东西,现在,每当我启动我的客户端,我都有以下消息框:


Microsoft WCF服务主机
目标程序集不包含服务类型。

您可能需要调整此程序集的代码访问安全性策略。


然后VS冻结1分钟,最终让我像往常一样调试我的程序。



我发现这个问题的一个帖子,但是解决方案不适用于我的情况。
任何想法?

解决方案

总是这样。你搜索2个小时,最终最终在SO上发布,5分钟后,你会找到答案。



WCF选项选项卡的项目的属性定义 ServiceContract
有一个复选框,标记为在同一解决方案中调试另一个项目时启动WCF服务主机,我未选中。



我不知道它是如何被检查的首先。



无论如何,这解决了我的问题。请参阅此项目设置的 MSDN参考


I've got a Client/Server wcf application

My executable doesn't define any ServiceContract, it doesn't even have a reference to System.ServiceModel (but instead has a reference to an assembly which contains the connection logic to the server)

I've another assembly, which is referenced by my EXE, which contains a ServiceContract.

It used to work fine. Yesterday, I've played a lot with my project settings (partial trust, full trust, deployment settings, and so on) and now, each and every time I launch my client, I've got the following message box :

Microsoft WCF Service Host
The target assembly contains no service types.
You may need to adjust the Code Access Security policy of this assembly.

Then VS freezes for 1 minute, and eventually lets me debug my program as usual.

I've found a post on this problem, but the solution doesn't apply in my situation. Any ideas?

解决方案

It's always like that. You search for 2 hours, you eventually end up posting on SO, and 5 minutes later, you find the answer.

In the WCF Options tab of the properties of the project defining the ServiceContract, there's a checkbox labelled "Start WCF Service Host when debugging another project in the same solution" that I unchecked.

I've no idea how it has been checked in the first place.

Anyway, that solved my problem. See the MSDN Reference for this project setting.

这篇关于如何摆脱“目标程序集不包含任何服务类型”错误消息在VS2008?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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