zoukankan      html  css  js  c++  java
  • “System.Transactions.Diagnostics.DiagnosticTrace”的类型初始值设定项引发异常[WCF]

    未处理System.TypeInitializationException
      HResult=-2146233036
      Message=“System.ServiceModel.Diagnostics.TraceUtility”的类型初始值设定项引发异常。
      Source=System.ServiceModel
      TypeName=System.ServiceModel.Diagnostics.TraceUtility
      StackTrace:
           在 System.ServiceModel.Diagnostics.TraceUtility.SetEtwProviderId()
           在 System.ServiceModel.ServiceHostBase..ctor()
           在 System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
           在 Wolfy.Server.Program.Main(String[] args) 位置 f:SUN.TESTWolfy.WcfTestClientWolfy.ServerProgram.cs:行号 16
           在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           在 System.Threading.ThreadHelper.ThreadStart()
      InnerException: System.Configuration.ConfigurationErrorsException
           HResult=-2146232062
           Message=配置系统未能初始化
           Source=System.Configuration
           BareMessage=配置系统未能初始化
           Line=0
           StackTrace:
                在 System.Configuration.ConfigurationManager.PrepareConfigSystem()
                在 System.Configuration.ConfigurationManager.GetSection(String sectionName)
                在 System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
                在 System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
                在 System.Diagnostics.DiagnosticsConfiguration.Initialize()
                在 System.Diagnostics.DiagnosticsConfiguration.get_IndentSize()
                在 System.Diagnostics.TraceInternal.InitializeSettings()
                在 System.Diagnostics.TraceInternal.get_Listeners()
           InnerException: System.Configuration.ConfigurationErrorsException
                HResult=-2146232062
                Message=无法识别的配置节 behaviors。....

                Source=System.Configuration
                BareMessage=无法识别的配置节 behaviors。
                Filename=F:SUN.TESTWolfy.WcfTestClientWolfy.ServerinDebugWolfy.Server.vshost.exe.Config
                Line=7
                StackTrace:
                     在 System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
                     在 System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
                     在 System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
                     在 System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
         ...........

    最后解决办法:

            出现此错误肯定是配置文件的问题,检查配置文件,是否少了标签。

            我这里报这个错误,是因为不想一步一步的写配置文件了,就从之前的项目中复制过来的,由于自己的粗心,发现忘了<system.serviceModel></system.serviceModel> 这对最主要的标签了,这里记录一下,提醒自己不要在这么粗心,这么懒了。

  • 相关阅读:
    echarts折线图
    利用echarts制作词云
    本周总结
    本周总结
    云服务器项目数据库连接超时问题解决
    iOS下载图片失败
    解决后台json数据返回的字段需要替换的问题
    设置User Agent
    Xcode升级到9.3之后pod问题
    gitLab创建自己的私有库
  • 原文地址:https://www.cnblogs.com/wolf-sun/p/3275271.html
Copyright © 2011-2022 走看看