나는 desesperated, WCF 서비스 (공유 형식)에 대한 기존 서비스 참조를 업데이트하려고하고 있는데 그럴 수 없습니다. 나는 Google에서 찾은 모든 것을 tryied했습니다 (social.msdn, stackoverflow, ...)하지만 내 문제에 대한 해결책을 찾지 못했습니다.WCF 업데이트 서비스 참조 오류
나는의 ServiceContract를했습니다 나는 아래의 코드와 같은 새로운 작업을 추가
Attempting to download metadata from 'http://localhost:65499/Services/Acciones/ProcesoServiceDTO.svc' using WS-Metadata Exchange or DISCO. Error: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: Referenced type 'mpm.seg.ServiceModel.DTO.DataContracts.Acciones.ProcesoDTO, mpm.seg.ServiceModel.DTO.DataContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' with data contract name 'ProcesoDTO' in namespace 'http://schemas.datacontract.org/2004/07/mpm.seg.ServiceModel.DTO.DataContracts.Acciones' cannot be used since it does not match imported DataContract. Need to exclude this type from referenced types.XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IProcesoServiceDTO']
: 나는 그것이 follwing을 오류 나를 던져 서비스 참조를 업데이트하려고하면
[ServiceContract]
public partial interface IServiceDTO : IGenericServiceDTO<EntityDTO>
{
// Some OperationContracts working like
[OperationContract]
EntityDTO[] Method(int field);
// NewMethod
[OperationContract]
OtherEntityDTO[] NewMethod(int field);
}
[DataContract]
public class EntityDTO {
// Some properties working
}
[DataContract]
public class OtherEntityDTO {
// Some properties working
[DataMember]
YetAnotherEntity NewProperty {get;set;}
}
우선, "... 가져온 DataContract와 일치하지 않기 때문에 사용할 수 없습니다."라는 문장을 정확히 이해하지 못합니다. svcutil이 참조 된 유형을 가져온 DataContract와 일치시키는 방법 클라이언트 프로젝트에서 참조 된 형식을 가진 프로젝트를 참조했습니다. 서버와 클라이언트가 같은 솔루션에 있지만 원인을 구분하고 정확하게 동일한 DLL을 참조하려고했습니다. 내가하려고 할 때
는 또한, 예를 들어, 다음과 같은 상황이 (이하 "EntityDTO에 OtherEntityDTO"의 쓰기 "NewProperty")를 작동하고, 나는 차이를 이해하지 않습니다
[ServiceContract]
public partial interface IServiceDTO : IGenericServiceDTO<EntityDTO>
{
// Some OperationContracts working like
[OperationContract]
EntityDTO[] Method(int field);
// NewMethod
[OperationContract]
OtherEntityDTO[] NewMethod(int field);
}
[DataContract]
public class EntityDTO {
// Some properties working
[DataMember]
YetAnotherEntity NewProperty {get;set;}
}
[DataContract]
public class OtherEntityDTO {
// Some properties working
}
주세요, 도와 주시고 진심으로 감사드립니다.
예, 문제가 다릅니다. 속성을 DataMember로 사용하려면 WCF를 통해 직렬화/역 직렬화되도록 가져오고 설정해야합니다. 이것을보십시오 : [StackOverflow thread] (http://stackoverflow.com/questions/1873741/wcf-exposing-readonly-datamember-properties-without-set) – Marc