' System.ServiceModel.Security.NegotiationTokenAuthenticator`1'的类型初始值设定项。

时间:2015-10-16 00:37:10

标签: c# .net wcf security wcf-data-services

托管命名管道的WCF服务开始抛出一些奇怪的错误,无法初始化并抛出奇怪的错误。

我最近升级到了VS2015 Ultimate,我改变了项目的命名空间。我确信更改命名空间会导致问题。

Config看起来很简单。

<system.serviceModel>
<bindings>
<netNamedPipeBinding>
<binding name="netNamedPipeBinding" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</netNamedPipeBinding>
</bindings>
<client/>
<services>
<service behaviorConfiguration="Company.Service1Behavior"  name="Company.DBSync">
<endpoint address="mex"  binding="mexNamedPipeBinding"  contract="IMetadataExchange"  kind="mexEndpoint" />
<endpoint binding="netNamedPipeBinding" bindingConfiguration="netNamedPipeBinding"  name="netPipeSync"  contract="Company.IDBSyncService" />
<host>
<baseAddresses>
<add baseAddress="net.pipe://localhost/Project/Sync/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Company.Service1Behavior">
<serviceMetadata httpGetEnabled="False"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

在对策略导出扩展的调用中抛出异常。 扩展:System.ServiceModel.Channels.WindowsStreamSecurityBindingElement 错误:System.ServiceModel.Security.NegotiationTokenAuthenticator`1&#39;的类型初始值设定项。抛出异常。

  

错误堆栈:       System.InvalidOperationException:在对策略导出扩展的调用中抛出异常。       扩展:System.ServiceModel.Channels.WindowsStreamSecurityBindingElement       错误:&#39; System.ServiceModel.Security.NegotiationTokenAuthenticator 1' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.ServiceModel.Security.NegotiationTokenAuthenticator 1&#39;的类型初始值设定项抛出一个例外。 ---&GT; System.TypeInitializationException:&#39; System.ServiceModel.DXD&#39;的类型初始值设定项。抛出一个例外。 ---&GT; System.InvalidProgramException:公共语言运行时检测到无效程序。

at System.ServiceModel.TrustDec2005Dictionary.PopulateDec2005DictionaryStrings()
       at System.ServiceModel.DXD..cctor()
       --- End of inner exception stack trace ---
       at System.ServiceModel.Security.WSSecurityTokenSerializer..ctor(SecurityVersion securityVersion, TrustVersion trustVersion, SecureConversationVersion secureConversationVersion, Boolean emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable`1 knownTypes, Int32 maximumKeyDerivationOffset, Int32 maximumKeyDerivationLabelLength, Int32 maximumKeyDerivationNonceLength)
       at System.ServiceModel.Security.WSSecurityTokenSerializer.get_DefaultInstance()
       at System.ServiceModel.Security.SecurityStandardsManager..ctor()
       at System.ServiceModel.Security.SecurityStandardsManager.get_DefaultInstance()
       at System.ServiceModel.Security.NegotiationTokenAuthenticator`1..cctor()
       --- End of inner exception stack trace ---
       at System.ServiceModel.Channels.LocalServiceSecuritySettings..ctor()
       at System.ServiceModel.Channels.SecurityBindingElement..ctor()
       at System.ServiceModel.Channels.TransportSecurityBindingElement..ctor()
       at System.ServiceModel.Channels.SecurityBindingElement.ExportPolicyForTransportTokenAssertionProviders(MetadataExporter exporter, PolicyConversionContext context)
       at System.ServiceModel.Description.MetadataExporter.ExportPolicy(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
       --- End of inner exception stack trace ---
       at System.ServiceModel.Description.ServiceMetadataBehavior.MetadataExtensionInitializer.GenerateMetadata()
       at System.ServiceModel.Description.ServiceMetadataExtension.EnsureInitialized()
       at System.ServiceModel.Description.ServiceMetadataExtension.WSMexImpl.GatherMetadata(String dialect, String identifier)
       at System.ServiceModel.Description.ServiceMetadataExtension.WSMexImpl.Get(Message request)
       at SyncInvokeGet(Object , Object[] , Object[] )
       at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

我从未将此设置为安全,因为这只能在本地计算机上运行。任何帮助,将不胜感激。

0 个答案:

没有答案