求助,如果有哪位对Windows server AppFabric1.1比较熟悉的同学,知道此问题如何解决,还望留言告之。 ”目前我有一个Web应用程序,这个程序的功能就是管理Windows server Appfabric的。当然这在后台实际都是通过调用一个 appfabric的管理命令进行的。而这些命令我又是通过WF来实现,然后以WCF的方式发布出来,以供Web应用程序调用。之前我是使用的控制台应用程序Host整个 WCF服务,运行一直很正常。 后来,我改为部署都IIS上,通过Appfabric host功能进行部署时就会报“Error: ErrorCode<ERRPS008>:SubStatus<ES0001>:Error: Could not read installation path from registry. ” 这样的错误。 此WCF服务的配置文件全文如下: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0"></compilation> </system.web> <system.serviceModel> <services> <service name="CacheHostService" behaviorConfiguration="netTcpServiceBehavior"> <endpoint address="net.tcp://localhost:4533/Service/CacheHostService.xamlx" binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="ICacheHostService"> </endpoint> <endpoint address="net.tcp://localhost:4533/Service/CacheHostService.xamlx/mex" binding="mexTcpBinding" contract="IMetadataExchange"></endpoint> </service> <service name="CacheClusterService" behaviorConfiguration="netTcpServiceBehavior"> <endpoint address="net.tcp://localhost:4533/Service/CacheClusterService.xamlx" binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="ICacheClusterService"> </endpoint> <endpoint address="net.tcp://localhost:4533/Service/CacheClusterService.xamlx/mex" binding="mexTcpBinding" contract="IMetadataExchange"></endpoint> </service> <service name="CacheService" behaviorConfiguration="netTcpServiceBehavior"> <endpoint address="net.tcp://localhost:4533/Service/CacheService.xamlx" binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="ICacheService"> </endpoint> <endpoint address="net.tcp://localhost:4533/Service/CacheService.xamlx/mex" binding="mexTcpBinding" contract="IMetadataExchange"></endpoint> </service> <service name="ConfigCommandService" behaviorConfiguration="netTcpServiceBehavior"> <endpoint address="net.tcp://localhost:4533/Service/ConfigCommandService.xamlx" binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="IConfigCommandService"> </endpoint> <endpoint address="net.tcp://localhost:4533/Service/ConfigCommandService.xamlx/mex" binding="mexTcpBinding" contract="IMetadataExchange"></endpoint> </service> </services> <bindings> <netTcpBinding> <binding name="PortSharingBinding" portSharingEnabled="true"> <security mode="None"></security> </binding> </netTcpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="netTcpServiceBehavior"> <serviceMetadata httpGetEnabled="false" /> <serviceDebug includeExceptionDetailInFaults="true" /> <dataContractSerializer maxItemsInObjectGraph="2147483647" /> <serviceAuthorization principalPermissionMode="None"> </serviceAuthorization> <serviceThrottling maxConcurrentCalls="2000" maxConcurrentInstances="2000" maxConcurrentSessions="2000" /> <serviceTimeouts transactionTimeout="00:10:00" /> </behavior> <behavior name=""> <sqlWorkflowInstanceStore instanceCompletionAction="DeleteAll" instanceEncodingOption="None" instanceLockedExceptionAction="NoRetry" connectionStringName="ApplicationServerWorkflowInstanceStoreConnectionString" hostLockRenewalPeriod="00:00:30" runnableInstancesDetectionPeriod="00:00:05" /> </behavior> </serviceBehaviors> </behaviors> <!---this code resolve the issue--> <serviceHostingEnvironment> <baseAddressPrefixFilters> <add prefix="net.tcp://localhost:4533/Service/" /> </baseAddressPrefixFilters> </serviceHostingEnvironment> <!--End above--> </system.serviceModel> <!--runtime section let sub thread impersonation main thread policy--> <runtime> <legacyImpersonationPolicy enabled="false"/> <alwaysFlowImpersonationPolicy enabled="true"/> </runtime> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> <directoryBrowse enabled="true" /> </system.webServer> </configuration> 把具体命令传入Appfabric的核心代码如下: internal static Collection<PSObject> InvokeCommand(this Runspace runSpace, string commandName, Dictionary<string, object> parameters = null) { Command command = new Command(commandName); if (parameters != null && parameters.Count > 0) { foreach (var item in parameters) { command.Parameters.Add(item.Key, item.Value); } } WindowsIdentity winId = WindowsIdentity.GetCurrent(); WindowsImpersonationContext ctx = null; Collection<PSObject> results = null; //shell.Invoke(); try { using (ctx = winId.Impersonate())// this code will let the pipelin.invoke() run as main thread's right { using (Pipeline pipeline = runSpace.CreatePipeline()) { pipeline.Commands.Add(command); results = pipeline.Invoke();//代码运行到此处时就报发错误 } } } catch (System.Exception objException) { // ctx.Undo(); throw objException; } return results; } 在对服务的IIS配置中,我配置以ASP.NET V4.0的应用程序池运行,并且以新建了一个具有管理员权限账号运行此服务。 如果有谁知道如何解决,或者知道这里的错误原因是什么? 还请告之小弟。不胜感激呀。