Net.Tcp Port Sharing Service服务无法启动

最近碰到运行一个Ajax项目,碰到如下错误:

 

  System.ServiceModel.Diagnostics.DiagnosticTrace..ctor(System.ServiceModel.Diagnostics.TraceSourceKind, System.String, System.String)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MethodAccessException: System.ServiceModel.Diagnostics.DiagnosticTrace..ctor(System.ServiceModel.Diagnostics.TraceSourceKind, System.String, System.String)

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:
[MethodAccessException: System.ServiceModel.Diagnostics.DiagnosticTrace..ctor(System.ServiceModel.Diagnostics.TraceSourceKind, System.String, System.String)]
   System.ServiceModel.DiagnosticUtility.InitDiagnosticTraceImpl(TraceSourceKind sourceType, String traceSourceName) +0
   System.ServiceModel.DiagnosticUtility.InitializeTracing() +31
   System.ServiceModel.DiagnosticUtility..cctor() +202

[TypeInitializationException: The type initializer for 'System.ServiceModel.DiagnosticUtility' threw an exception.]
   System.ServiceModel.DiagnosticUtility.get_ShouldTraceVerbose() +0
   System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetAssociatedSection(ContextInformation evalContext, String sectionPath) +187
   System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetSection(String sectionPath) +33
   System.ServiceModel.Configuration.ServiceHostingEnvironmentSection.UnsafeGetSection() +37
   System.ServiceModel.HostingManager.LoadConfigParameters() +77
   System.ServiceModel.HostingManager..ctor() +155
   System.ServiceModel.ServiceHostingEnvironment.EnsureInitialized() +338
   System.ServiceModel.ServiceHostingEnvironment.OnEnsureInitialized(Object state) +26
   System.ServiceModel.PartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state) +115
   System.ServiceModel.ServiceHostingEnvironment.SafeEnsureInitialized() +86
   System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +93
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

 

在网上找了很久,大多的意思是WCF没有装好,说是要重装什么的,还有要说要重置系统的安全策略.

当然我怀疑是System.serviceModel的权限受限制,还在WMI里手动更改ServiceModel权限.方法都试遍了,都没找到方法.

问题依然存在.

另外,我发现系统服务Net.Tcp Port Sharing Service(默认禁用)也启动不了,报错了,看下日志,发现问题还是出在serviceModel上,以下系统日志参考:

 

A request to start the service failed.
 Error Code: System.TypeInitializationException: “System.ServiceModel.DiagnosticUtility”的类型初始值设定项引发异常。 ---> System.MethodAccessException: System.ServiceModel.Diagnostics.DiagnosticTrace..ctor(System.ServiceModel.Diagnostics.TraceSourceKind, System.String, System.String)
   在 System.ServiceModel.DiagnosticUtility.InitDiagnosticTraceImpl(TraceSourceKind sourceType, String traceSourceName)
   在 System.ServiceModel.DiagnosticUtility.InitializeTracing()
   在 System.ServiceModel.DiagnosticUtility..cctor()
   --- 内部异常堆栈跟踪的结尾 ---
   在 System.ServiceModel.DiagnosticUtility.get_ShouldUseActivity()
   在 System.ServiceModel.Channels.CommunicationObject.set_TraceOpenAndClose(Boolean value)
   在 System.ServiceModel.ServiceHostBase..ctor()
   在 System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
   在 System.ServiceModel.Activation.SharingService.StartControlService()
   在 System.ServiceModel.Activation.TcpPortSharing.OnStart(String[] args)
 Process Name: SMSvcHost
 Process ID: 5740

 

今天终于找到解决办法了.在老外讨论贴上看到的:


1。 关闭所有的Visual Studio实例和所有应用程序。
2。 下载并解压缩文件到一些附加的位置(C:/文件,例如)。
3。 打开Visual Studio命令提示符。
4。 转到C:/文件目录(cd /文件)
5。 使用Gacutil /if file_name中,以取代双方System.Runtime.Serialization.dll和SMdiagnostics.dll文件。

((你应该同时执行gacutil /if System.Runtime.Serialization.dll和gacutil /if SMdiagnostics.dll))

 

相关文件链接ServiceModel_files.zip

原贴地址:

http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/q1-2009-beta-bug.aspx

 

 

 

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值