I cant figure out whats wrong with my config code below, when I include the NServiceBus config info I get the followng error:
The Type Initializer for 'System.ServiceModel.Diagnostics.TraceUtility' threw an exception'
The message goes away when I comment out the NServiceBus code so its not related to a faulted instal of the .net framework like some of the interwebs suggested.
Any ideas would be appreciated!
The error is caused when my code gets to the constructor for WebClient belowfollowing point:
WEBCallback = new CFPWebImplementation();
WEBContext = new InstanceContext(WEBCallback);
WEBClient = new TradeOperationsClient(WEBContext);
and my config file:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_ITradeOperations" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:8687/TradePortal/Operations/"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_ITradeOperations"
contract="CFP_Web.ITradeOperations" name="NetTcpBinding_ITradeOperations" />
</client>
</system.serviceModel>
<configSections>
开发者_如何转开发 <section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core"/>
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core"/>
</configSections>
<MsmqTransportConfig InputQueue="HammersmithInputQueue" ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5"/>
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="Messages" Endpoint="BBRGInputQueue"/>
</MessageEndpointMappings>
</UnicastBusConfig>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Turns out the answer was that the needs to be the first element in the app.config file
精彩评论