[Mono-dev] dataContractSerializer service behavior causes InvalidCastException
Uli Hertlein
uli at xdt.com.au
Mon Jan 30 06:04:17 UTC 2012
Hi guys,
after making some changes to my app.config file to allow WCF to
serialize larger graphs I'm getting an InvalidCastException when running
on mono.
ProxyTask: System.InvalidCastException: Cannot cast from source type to
destination type.
at System.ServiceModel.ServiceHostBase.AddServiceBehaviors
(System.String configurationName, Boolean throwIfNotFound) [0x00000] in
<filename unknown>:0
at System.ServiceModel.ServiceHostBase.ApplyServiceElement
(System.ServiceModel.Configuration.ServiceElement service) [0x00000] in
<filename unknown>:0
at System.ServiceModel.ServiceHostBase.LoadConfigurationSection
(System.ServiceModel.Configuration.ServiceElement element) [0x00000] in
<filename unknown>:0
at System.ServiceModel.ServiceHostBase.ApplyConfiguration ()
[0x00000] in <filename unknown>:0
at System.ServiceModel.ServiceHostBase.InitializeDescription
(System.ServiceModel.UriSchemeKeyedCollection baseAddresses) [0x00000]
in <filename unknown>:0
at System.ServiceModel.ServiceHost.InitializeDescription (System.Type
serviceType, System.ServiceModel.UriSchemeKeyedCollection baseAddresses)
[0x00000] in <filename unknown>:0
at System.ServiceModel.ServiceHost..ctor (System.Type serviceType,
System.Uri[] baseAddresses) [0x00000] in <filename unknown>:0
The offending line in my 'app.config' is this:
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ProxyBehavior">
<!-- Mono does not like this at all. -->
<!--
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
-->
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ProxyBehavior" name="Proxy">
<endpoint
address=""
binding="basicHttpBinding"
bindingConfiguration="ProxyBasicHttpBinding"
contract="IProxy" />
</service>
</services>
</system.serviceModel>
</configuration>
The recipe for this comes from
http://smehrozalam.wordpress.com/2009/01/29/retrieving-huge-amount-of-data-from-wcf-service-in-silverlight-application
My guess so far is that DataContractSerializerOperationBehavior is
implementing IOperationBehavior and IWsdlExportExtension, there doesn't
seem to be anything implemented related to ServiceBehavior.
Any WCF gurus out there that may have an idea what's happening?
Cheers,
/uli
More information about the Mono-devel-list
mailing list