WCF服务引用代理生成无法更新MVC3中的web.config

时间:2012-01-25 20:33:02

标签: wcf asp.net-mvc-3 svcutil.exe

当我在当前的ASP.net MVC 3项目中向WCF Web服务添加服务引用时,代理类已成功生成,但没有向web.config添加任何信息。当我尝试使用no-args构造函数实例化代理类时,这会导致错误。在这一行:

var proxy = new ReportingService.ApiServiceClient();

我得到以下运行时异常:

Could not find default endpoint element that references contract 
'ReportingService.IApiService' in the ServiceModel client configuration
section. This might be because no configuration file was found for your
application, or because no endpoint element matching this contract could 
be found in the client element.

这是有道理的,因为我的配置文件中没有任何内容表示默认端点。

我错过了什么?为什么添加服务引用无法创建默认端点?

0 个答案:

没有答案
相关问题