Nir*_*man 25 wcf contract endpoint
我收到一条错误消息:
合同属性无效.根据其数据类型'clientcontracttype',该值无效
以下是此WCF应用程序的web.config中的端点配置.我正在使用.NET Framework 4.5和Visual Studio 2012.我已经验证合同OnlineReporting.Core.Contracts.IReportingInternalWcfPortal已经存在.
<endpoint address="http://localhost:63817/ReportingInternalWcfPortal.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding"
contract="OnlineReporting.Core.Contracts.IReportingInternalWcfPortal"
name="ReportingInternalPortal" />
Run Code Online (Sandbox Code Playgroud)
Ora*_*g89 22
我发现这个问题在Web服务项目上寻找相同的错误.
在我的情况下,当我忘记[ServiceContract]在IServiceBase界面上添加属性时发生此错误.
一旦我在错误中添加它就消失了.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace MyService
{
[ServiceContract]
public interface IServiceBase
{
[OperationContract]
IEnumerable<ListItem> GetListItems();
[OperationContract]
void SaveListItems(IEnumerable<ListItem> listItems);
}
Run Code Online (Sandbox Code Playgroud)
小智 21
我看到这个问题很老了,我不知道你现在是否找到了解决办法,但为了以防万一,这是我发现的将解决的问题:
1)在Solution Explorer中的Service References文件夹下,右键单击出现问题的服务引用名称,然后选择"Configure Service Reference".
2)将出现"服务参考设置"窗口.取消选中标记为"在引用的程序集中重用类型"的框,然后单击"确定"按钮.
3)重建项目.
重建后,警告应该消失.
| 归档时间: |
|
| 查看次数: |
52700 次 |
| 最近记录: |