我在同时使用 WCF 服务和实体模型时遇到了问题。我已经从我现有的数据库中创建了一个实体模型。这可以在下面显示;
在来自“实体对象代码生成器”的任何控制台应用程序中使用我的类时没有任何问题。
然后,我用下面的接口创建了 WCF 服务:
[ServiceContract]
public interface IAuthorServices
{
[OperationContract]
[WebGet( UriTemplate="GetNews")]
List<Newspaper> GetNews();
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "GetAuthors")]
List<Author> GetAuthors();
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "GetAuthorTexts")]
List<AuthorText> GetAuthorTexts();
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "GetTodaysTexts")]
List<AuthorText> GetTodaysTexts();
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "GetExceptions")]
List<KoseYazilari.Exception> GetExceptions();
}
但是,当我在服务类中实现这些方法并运行我的客户端应用程序时,我收到了类似的错误
我怎样才能摆脱这个问题?
问候, 凯马尔