WCF Error message 'The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly' - wcf

I received following error message, while invoke my WCF Function
The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly
at System.Diagnostics.PerformanceCounter.InitializeImpl()
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean readOnly)
at Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EnterpriseLibraryPerformanceCounterFactory.CreateCounter(String categoryName, String counterName, String[] instanceNames)
at Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers.PerformanceCounterCallHandler.Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext)
at Example.SoaPlatform.LoggingService.Client.LogTraceCallHandler.Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext)
at Microsoft.Practices.Unity.InterceptionExtension.HandlerPipeline.Invoke(IMethodInvocation input, InvokeHandlerDelegate target)
at Microsoft.Practices.Unity.InterceptionExtension.InterceptingRealProxy.Invoke(IMessage msg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Example.Mobiliti.MobilitiAlertService.ContractTypes.IMobilitiAlertService.SendSMSAlert(SendSmsAlertRequest request)
at SyncInvokeSendSMSAlert(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)</StackTrace>
I ran the following commands, still the issue not yet resolved.
lodctr /R
cd C:\Windows\Inf\.NETFramework
lodctr corperfmonsymbols.ini
Enterprise Library version is 4.1.0, I checked through file properties

Related

How to avoid IE Navigation error which says the RPC server is unavailable?

I have a service which is installed on my server. It suddenly stops with the following error log:
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.VisualBasic.CompilerServices.VBBinder.InvokeMember(String name, BindingFlags invokeAttr, Type objType, IReflect objIReflect, Object target, Object[] args, String[] namedParameters)
at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn)
at vbIranStock.VBNetLib.vbScript4.Parsing(Object& objIE, Object& MainHTML, String[]& logid, String& logpath, String& Servicepath, Boolean& doPrint) in vbScript4.vb:line 119
at vbIranStock.VBNetLib.vbScript4.VbsRun4(Boolean doPrint) in vbScript4.vb:line 50
at WindowsServiceVB.Service1.MyProgram() in Service1.vb:line 106
at WindowsServiceVB.Service1.ScheduleService() in Service1.vb:line 73
When I refer to the specified Visual Basic code line, I see following codes:
119: objIE.Navigate("https://www.example.ir" + lblUrl)
I checked following RPC related services which all are running and are not stopped:
Remote Process Call
Remote Process Call Locator
DeCom Server Process Launcher
RPC Endpoint Mapper
Remote Access Connection Manager
Remote Access Auto Connection Manager
Remote Registry
Besides I checked firewall and added inbound and outbound rules to allow my service connection.
But again I have this error. Please help me to stop getting the error.

How to make Akka.NET's ClusterClient work?

I'm trying out ClusterClient as per the docs.
However my client test app keeps getting the following error:
Error while creating actor instance of type Akka.Cluster.Tools.Client.ClusterClient with 1 args: (Akka.Cluster.Tools.Client.ClusterClientSettings)
Cause: [akka://TestSystem/user/$a#705838478]: Akka.Actor.ActorInitializationException: Exception during creation ---> System.TypeLoadException: Error while creating actor instance of type Akka.Cluster.Tools.Client.ClusterClient with 1 args: (Akka.Cluster.Tools.Client.ClusterClientSettings) ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: failure-detector.heartbeat-interval must be > 0s
at Akka.Remote.DeadlineFailureDetector..ctor(TimeSpan acceptableHeartbeatPause, TimeSpan heartbeatInterval, Clock clock)
at Akka.Remote.DeadlineFailureDetector..ctor(TimeSpan acceptableHeartbeatPause, Clock clock)
at Akka.Cluster.Tools.Client.ClusterClient..ctor(ClusterClientSettings settings)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Akka.Actor.Props.ActivatorProducer.Produce()
at Akka.Actor.Props.NewActor()
--- End of inner exception stack trace ---
at Akka.Actor.Props.NewActor()
at Akka.Actor.ActorCell.CreateNewActorInstance()
at Akka.Actor.ActorCell.<>c__DisplayClass118_0.<NewActor>b__0()
at Akka.Actor.ActorCell.UseThreadContext(Action action)
at Akka.Actor.ActorCell.NewActor()
at Akka.Actor.ActorCell.Create(Exception failure)
--- End of inner exception stack trace ---
at Akka.Actor.ActorCell.Create(Exception failure)
at Akka.Actor.ActorCell.SysMsgInvokeAll(EarliestFirstSystemMessageList messages, Int32 currentState)
The minimal code I'm using to get this error:
using (var system = ActorSystem.Create("TestSystem")) {
system.Settings.InjectTopLevelFallback(ClusterClientReceptionist.DefaultConfig());
var settings = ClusterClientSettings.Create(system);
var client = system.ActorOf(ClusterClient.Props(settings));
Console.Write("Press any key to exit...");
Console.ReadKey();
}
The HOCON config for the client contains:
akka {
actor {
provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
}
remote {
helios.tcp {
port = 0
hostname = localhost
}
}
cluster {
client {
initial-contacts: ["akka.tcp://TestSystem#localhost:8082/user/receptionist"]
}
}
}
Also checked the settings variable, seemed to be populated and looks ok to me:
Tried several random stuff to actually fulfill the error message:
failure-detector.heartbeat-interval must be > 0s
including various permutation of HOCON entries, but to no avail.
Anything else I missed out?
Update #1
Modified HOCON to initialize Akka.Remote.
Still received what looks like the same error message.
But now it is stating:
failure-detector.heartbeat-interval must be > 0s
Previously it was stating:
failure-detector.acceptable-heartbeat-pause must be >= 0s
Managed to make it working now.
The cause of the issue: I was using Akka.Cluster.Tools latest release version 1.0.6
The fix: Upgraded to the latest beta version 1.1.2.30-beta
p/s: I wished the docs could have specified the minimum NuGet version required to make it work.

System.ObjectDisposedException: Store must be open for this operation

there is an MVC4 application on IIS7 Windows2008 machine. the application runs as ApplicationPoolIdentity and the appropriate user has access to the ProgramData\IsolatedStorage folder.
it has also permission on the C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage folder as well.
but still receive exception while writing big excel files with openxml.
ERROR MHDB.MvcApplication - System.ObjectDisposedException: Store must be open for this operation.
at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, IsolatedStorageFile isf)
at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, IsolatedStorageFile isf)
at MS.Internal.IO.Packaging.PackagingUtilities.SafeIsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, ReliableIsolatedStorageFileFolder folder)
at MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount, String& fileName)
at MS.Internal.IO.Packaging.SparseMemoryStream.EnsureIsolatedStoreStream()
at MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary()
at MS.Internal.IO.Packaging.CompressEmulationStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.Xml.XmlUtf8RawTextWriter.FlushBuffer()
at System.Xml.XmlUtf8RawTextWriter.RawText(Char* pSrcBegin, Char* pSrcEnd)
at System.Xml.XmlUtf8RawTextWriter.WriteEndElement(String prefix, String localName, String ns)
at System.Xml.XmlWellFormedWriter.WriteEndElement()
at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter)
at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter)
at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
at DocumentFormat.OpenXml.OpenXmlPartRootElement.WriteTo(XmlWriter xmlWriter)
at DocumentFormat.OpenXml.OpenXmlPartRootElement.SaveToPart(OpenXmlPart openXmlPart)
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.SavePartContents()
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose(Boolean disposing)
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose()
at BL.OpenXML.Export(DataTable dt, Stream fs, Boolean createNewDocument)
at BL.BusinessLogic.CreateOpReport(UnitOfWork uow, String user, String orgapath, List`1 orgaids, Boolean isfin, String cycle, String startperiod, String endperiod)
at MHDB.Controllers.HomeController.GetFileAsStream()
at MHDB.Controllers.HomeController.ExportExcel()
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<InvokeActionMethodWithFilters>b__10()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
thanks for any help!
Due to the System.IO.Packaging when you write files larger than 10MB internally it will no longer hold the data temporarily in memory until next save but will switch over to Isolated Storage. That on its own can cause a lot of problems because IsolateStorage is not meant to be used with multiple thread/multiple instances of the same application and you could be facing some permission issues with this as well.
Considering that this is a web app I think it may relate to multiple user writing at same time but all being resolved to the same Isolated Storage location..
I have stumbled upon this problem with multiple instances of same app all being resolved to same location. I am still looking for an elegant solution but I was able to force each instance to be resolved to a different IsolatedStorage location and be unique by using this:
var rootDirUserField= typeof(IsolatedStorageFile).GetField("s_RootDirUser", BindingFlags.NonPublic | BindingFlags.Static);
rootDirUserField.SetValue(null, "<unique location in isolated storage>");
This works because the static field IsolatedStorageFile.s_RootDirUser is used in resolving a new directory to use. My fix was specific to the User | Domain | Assembly scope.
I am keen to get a better solution to fix this problem.

System.Assembly.Load() Error

So I'm trying to load a Windows Forms application with Assembly.Load() and it's throwing this error when the bytes are trying to run:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application.
at System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(Boolean defaultValue)
at CrypterTestFile.My.MyApplication.Main(String[] Args)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Test.Module1.Main() in C:\Users\Jeffrey\AppData\Local\Temporary Projects\Test\Module1.vb:line 15
Here's my code:
Dim entryPoint As MethodInfo = Assembly.Load(IO.File.ReadAllBytes(OFD.FileName)).EntryPoint
If entryPoint.GetParameters().Length = 0 Then
entryPoint.Invoke(Nothing, Nothing)
Else
entryPoint.Invoke(Nothing, New Object() {New String() {"0"}})
'Error is being thrown ^
End If
I'm not sure why this is happening, but it's just a simple Windows Forms application that has a label in the center of it.

EPiServer-error, Dynamic Data Store 6.2.267.1 can only be used with database version 6204, current version is 6001

I have upgraded a database from EPiServer 5 to 6 R2.
Current database-version is '6103' according to a script run in Microsoft SQL Server Management Studio. However when I try to access the website I get the following error ('current version is 6001'):
Previously a copy of the same database has run successfully with the same website (same web.config and the other files the same (the only difference is the database of the connectionstring).
Dynamic Data Store 6.2.267.1 can only be used with database version 6204, current version is 6001. Make sure both database and assemblies are upgraded correctly.
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.InvalidOperationException: Dynamic Data Store 6.2.267.1 can only be used with database version 6204, current version is 6001. Make sure both database and assemblies are upgraded correctly.
Source Error:
[No relevant source lines]
Source File: c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\87acb86c\7104e381\App_global.asax.j09cuuvu.0.cs Line: 0
Stack Trace:
[InvalidOperationException: Dynamic Data Store 6.2.267.1 can only be used with database version 6204, current version is 6001. Make sure both database and assemblies are upgraded correctly.]
EPiServer.Data.Dynamic.Providers.DbDataStoreProvider.ValidateVersion() +427
EPiServer.Data.Dynamic.Providers.DbDataStoreProvider.get_Connection() +36
EPiServer.Data.Dynamic.Providers.DbDataStoreProvider.CreateCommand() +16
EPiServer.Data.Dynamic.Providers.DbDataStoreProvider.ValidateVersion() +75
EPiServer.Data.Dynamic.Providers.DbDataStoreProvider.Initialize(String name, NameValueCollection config) +564
EPiServer.Data.Dynamic.Providers.DataStoreProvider.CreateInstance(ProviderSettings providerSettings) +198
EPiServer.Data.Dynamic.Providers.DataStoreProvider.CreateInstance() +145
EPiServer.Data.Dynamic.<>c__DisplayClass1.<InternalGet>b__0() +11
EPiServer.Data.Cache.LocalCache`2.Add(TKey key, Boolean cacheNullValues, Boolean overwriteExistingValue, Func`1 action) +140
EPiServer.Data.Cache.ReplicatedCache`1.Add(String key, Boolean cacheNullValues, Boolean overwriteExistingValue, Func`1 action, Boolean broadcast) +28
EPiServer.Data.Dynamic.StoreDefinition.InternalGet(String storeName) +172
EPiServer.Data.Dynamic.EPiServerDynamicDataStoreFactory.CreateStore(String storeName, Type type, StoreDefinitionParameters parameters) +110
EPiServer.Data.Dynamic.EPiServerDynamicDataStoreFactory.CreateStore(Type type) +35
EPiServer.Web.InitializationModule.InitializeDynamicDataStore() +169
EPiServer.Web.InitializationModule.<Initialize>b__1a() +5
EPiServer.Web.InitializeEngine.Initialize() +235
EPiServer.Web.InitializationModule.Initialize(EPiServerSection config, Settings settings, ConnectionStringSettingsCollection connectionStringSettings) +2832
EPiServer.Web.InitializationModule.<StaticInitialization>b__4() +34
EPiServer.Web.InitializeEngine.Initialize() +235
EPiServer.Web.InitializationModule.StaticInitialization() +1490
EPiServer.Web.InitializationModule.Initialize(InitializationEngine context) +47
EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +343
EPiServer.Framework.Initialization.InitializationEngine.Initialize(HostType hostType) +83
EPiServer.Framework.Initialization.InitializationModule.Initialize(HostType hostType) +163
EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +68
EPiServer.Global..ctor() +54
ASP.global_asax..ctor() in c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\87acb86c\7104e381\App_global.asax.j09cuuvu.0.cs:0
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1136
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +23
System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +227
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +327
How do I resolve this?
Sounds like you have had a mix of hotfixed and non-hotfixed 6 R2 environments.
You need to run the SchemaUpdate.sql script for the database giving the error message you posted.
More info here:
http://world.episerver.com/Blogs/Shahid-Nawaz/Dates/2012/1/General-Hotfix-CMS-6-R2/