ciao!
sto facendo qualche test su WCF giust per capirne il funzionamento.
ho creato un progetto, e sto cercando di mandare l'output in formato JSON.
ho visto che dovrei configurare l'App.config con webHttp:
codice:
<behaviors>
<serviceBehaviors>
<behavior>
<!-- Per evitare la diffusione di informazioni sui metadati,
impostare i valori seguenti su false prima della distribuzione -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<!-- Per ricevere i dettagli sull'eccezione per scopi di debug in caso di guasti,
impostare il valore riportato sotto su true. Impostarlo su false prima della diffusione
per evitare di diffondere informazioni sull'eccezione -->
<serviceDebug includeExceptionDetailInFaults="False" />
<webHttp />
</behavior>
</serviceBehaviors>
</behaviors>
ma ottento sempre un errore:
codice:
System.Configuration.ConfigurationErrorsException: Impossibile aggiungere l'estensione di comportamento 'webHttp' al comportamento del servizio con nome '' perché il tipo del comportamento sottostante non implementa l'interfaccia IServiceBehavior. (C:\VS_Proj\WcfServiceLibrary1\WcfServiceLibrary1\bin\Debug\WcfServiceLibrary1.dll.config line 48)
in System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
in System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
in System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
in System.Configuration.ContextInformation.GetSection(String sectionName)
in System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetSectionFromContext(ContextInformation evalContext, String sectionPath)
in System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetAssociatedSection(ContextInformation evalContext, String sectionPath)
in System.ServiceModel.Configuration.BehaviorsSection.UnsafeGetAssociatedSection(ContextInformation evalContext)
in System.ServiceModel.Description.ConfigLoader.LookupServiceBehaviors(String behaviorName, ContextInformation context)
in System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress, Boolean skipHost)
in System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, ServiceElement serviceSection)
in System.ServiceModel.ServiceHostBase.ApplyConfiguration()
in System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses)
in System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
in Microsoft.Tools.SvcHost.ServiceHostHelper.CreateServiceHost(Type type, ServiceKind kind)
in Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info)
dove sto sbagliando??