J'ai des problèmes avec un service WCF. Le type de retour est un type semi-complexe qui fait référence à divers types de base et à une interface de base dont chacun de ces types hérite.Comment résoudre cette exception WCF?
Dans mon débogage, la taille totale des octets du message sérialisé est bien inférieure au seuil par défaut de 65535 octets. Néanmoins, j'ai augmenté l'attribut maxReceivedMessageSize à 1000000 et le problème persiste.
Le service WCF est défini comme suit:
[ServiceContract]
public interface ILoggingService
{
[OperationContract]
NotesInfo ListNotes(NotesQueryOptions options);
}
Voici la définition de l'objet de retour NotesInfo:
[DataContract]
public class NotesInfo
{
[DataMember] public List<TokenizedNote> Notes { get; set; }
[DataMember] public Dictionary<long, User> Users { get; set; }
[DataMember] public Dictionary<long, NoteCategory> NoteCategories { get; set; }
[DataMember] public Dictionary<string, Dictionary<long, IIdentifiable<long>>> EntitiesByToken { get; set; }
}
Lorsque je tente d'appeler le service, je obtenir l'exception suivante levée:
The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ServiceModel.CommunicationException: The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
Source Error:
Line 242:
Line 243: public AxeFrog.Mobile.NotesInfo ListNotes(AxeFrog.Mobile.NotesQueryOptions options) {
Line 244: return base.Channel.ListNotes(options);
Line 245: }
Line 246: }
Source File: C:\Users\Nathan\Work\Internal Projects\AxeFrog System\Source\Trunk\AxeFrog.Mobile.WebInterface\Service References\LoggingServiceReference\Reference.cs Line: 244
est Ci-dessous le code pour les autres entités impliquées:
public interface IIdentifiable<TID>
{
TID ID { get; set; }
}
[DataContract]
public class Note : IIdentifiable<long>
{
[DataMember] public long ID { get; set; }
[DataMember] public DateTime DateStamp { get; set; }
[DataMember] public long? UserID { get; set; }
[DataMember] public long NoteCategoryID { get; set; }
[DataMember] public NoteType NoteType { get; set; }
[DataMember] public string Message { get; set; }
}
public enum NoteType
{
Information = 0,
Warning = 10,
Failure = 20
}
[DataContract]
public class NoteCategory : IIdentifiable<long>
{
[DataMember] public long ID { get; set; }
[DataMember] public string Name { get; set; }
}
[DataContract]
public class NoteEntityType : IIdentifiable<long>
{
[DataMember] public long ID { get; set; }
[DataMember] public Type TypeName { get; set; }
}
[DataContract]
public class TokenizedNote
{
[DataMember] public Note Note { get; set; }
[DataMember] public List<NoteSegment> NoteSegments { get; set; }
}
public abstract class NoteSegment
{
public abstract string Render(INoteRenderer renderer, Dictionary<string, Dictionary<long, IIdentifiable<long>>> entitiesByToken);
}
[DataContract]
public class NoteTextSegment : NoteSegment
{
[DataMember]
public string Text { get; set; }
}
[DataContract]
public class NoteEntitySegment : NoteSegment
{
[DataMember] public long EntityID { get; set; }
[DataMember] public string Token { get; set; }
}
Notez que j'ai supprimé le Render() remplace des implémentations abstraites de NoteSegment par souci de lisibilité .
Voici quelques informations de thedebugger afin que vous puissiez voir ce qui est retourné:
Toute idée de ce que je pourrais faire mal ici serait apprécié. Une recherche Google donne peu de réponses utiles.
est-ce un LAN d'entreprise derrière un pare-feu? Dans ce cas, je recommande la liaison NetTcp - beaucoup plus rapide et plus efficace que le standard, plutôt lourd wsHttpBinding ... –
mais netTcp a besoin de IIS7 (Win Server 2008 ou supérieur ou Vista) ou auto-hébergement –
Non, tout est sur localhost à ce stade. –