I have an intermittent error which shows up in my code. When I debug it using Visual Studio, with break on all exceptions (caught & uncaught) it doesn't break, so I'm not sure what to do.
It looks like it's the session state provider from the stack trace, here is the config:
<sessionState mode="Custom" customProvider="RedisSessionProvider">
<providers>
<add name="RedisSessionProvider" type="Microsoft.Web.Redis.RedisSessionStateProvider" port="6380" host="2asdasdasdasd.redis.cache.windows.net" accessKey="2asdasdasdasd=" ssl="true" />
</providers>
</sessionState>
I installed StackExchange.Redis from NuGet, I'm runnning 1.0.297. I'm unable to reproduce this regularly, I've tried a variety of browsers and operating systems, and it just happens "sometimes".
Here is the stack trace:
Object reference not set to an instance of an object.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.NullReferenceException: Object reference not set to an instance of an object.
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:
[NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.Web.Redis.StackExchangeClientConnection.Eval(String script, String[] keyArgs, Object[] valueArgs) +246
Microsoft.Web.Redis.RedisConnectionWrapper.Set(ISessionStateItemCollection data, Int32 sessionTimeout) +60
Microsoft.Web.Redis.RedisSessionStateProvider.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +802
System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +565
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
Related
i'm working with React.NET, i recently updated those nugets:
And now i receive this error :
Method not found: 'JavaScriptEngineSwitcher.Core.IJsEngine JSPool.IJsPool.GetEngine(System.Nullable`1<System.TimeSpan>)'.
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.MissingMethodException: Method not found: 'JavaScriptEngineSwitcher.Core.IJsEngine JSPool.IJsPool.GetEngine(System.Nullable`1<System.TimeSpan>)'.
Stack trace:
[MissingMethodException: Method not found: 'JavaScriptEngineSwitcher.Core.IJsEngine JSPool.IJsPool.GetEngine(System.Nullable`1<System.TimeSpan>)'.]
React.JavaScriptEngineFactory.GetEngine() +0
System.Lazy`1.CreateValue() +741
System.Lazy`1.LazyInitValue() +430
React.ReactEnvironment.EnsureUserScriptsLoaded() +40
React.ReactEnvironment.CreateComponent(String componentName, T props, String containerId, Boolean clientOnly) +43
Google didn't helped much, maby you can.
Thanks.
JavaScriptEnginerSwitch 2.0 is not supported yet: https://github.com/reactjs/React.NET/issues/319
and
https://github.com/reactjs/React.NET/issues/306
You will need to revert back to the previous version of those packages to get things working.
I am attempting a simple example project to get to know how to configure a Windows Azure Cloud service to use Co-located caching.
I am using VS2010 and have followed this example but when I get to the end of the section on co-located caching, I cannot run my project locally. It worked fine when
I am getting the following exceptions: (I hope it's readable..)
Error in '/' Application.
The requested name is valid, but no data of the requested type was found
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.Net.Sockets.SocketException: The requested name is valid, but no data of the requested type was found
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:
[SocketException (0x2afc): The requested name is valid, but no data of the requested type was found]
Microsoft.ApplicationServer.Caching.AsyncResultNoResult.EndInvoke() +202
Microsoft.ApplicationServer.Caching.AsyncResult`1.EndInvoke() +40
Microsoft.ApplicationServer.Caching.SocketConnectionFactory.EndConnect(IAsyncResult asyncResult) +75
Microsoft.ApplicationServer.Caching.TcpClientChannelFactory.TcpConnectionCallback(IAsyncResult result) +182
[DataCacheException: ErrorCode:SubStatus:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.). Additional Information : The client was trying to communicate with the server: net.tcp://SessionStateDemo:24233.]
Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ErrStatus errStatus, Guid trackingId, Exception responseException, Byte[][] payload, EndpointID destination) +767
Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody, EndpointID destination) +149
Microsoft.ApplicationServer.Caching.DataCacheFactory.EstablishConnection(IEnumerable1 servers, RequestBody request, Func3 sendMessageDelegate, DataCacheReadyRetryPolicy retryPolicy) +1313
Microsoft.ApplicationServer.Caching.<>c__DisplayClass5.b__2(RequestBody req) +198
Microsoft.ApplicationServer.Caching.SocketClientProtocol.SendReceive(IVelocityRequestPacket request, Func2 delegate, EndpointID& destination) +121
Microsoft.ApplicationServer.Caching.SocketClientProtocol.Initialize(IEnumerable1 servers) +1225
Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String cacheName, CreateNewCacheDelegate cacheCreationDelegate, DataCacheInitializationViaCopyDelegate initializeDelegate) +1104
Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String cacheName) +131
Microsoft.Web.DistributedCache.DataCacheFactoryWrapper.CreateDataCacheFromFactory(DataCacheFactory factory, String cacheName) +63
Microsoft.Web.DistributedCache.CacheHelpers.RunCacheCreationHooks(CacheConnectingEventArgs fetchingEventArgs, IDataCacheFactory dataCacheFactory, Object sender, EventHandler1 fetchingHandler, EventHandler1 fetchedHandler) +306
Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider.CreateInternalProvider(IHttpRuntime httpRuntime, SessionInitializationData initData, IDataCacheFactory dataCacheFactory, EventHandler1 cacheFetching, EventHandler1 cacheFetched) +399
Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider.GetInternalProvider() +315
Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider.CreateNewStoreData(HttpContext context, Int32 timeout) +59
System.Web.SessionState.SessionStateModule.InitStateStoreItem(Boolean addToContext) +160
System.Web.SessionState.SessionStateModule.CompleteAcquireState() +340
System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +1269
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +12698078
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
Can anyone tell me what is happening here? How can I fix this?
Is there something missing in that tutorial that I need to do?
EDIT: I am using VS2010 Professional, with Windows Azure SDK 2.1. Widnows Azure Cache package is v2.1.0.
Relevant web.config sections:
<system.web>
...
<!-- Windows Azure Caching session state provider -->
<sessionState mode="Custom" customProvider="AFCacheSessionStateProvider">
<providers>
<add name="AFCacheSessionStateProvider" type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" applicationName="AFCacheSessionState"/>
</providers>
</sessionState>
...
<sytem.web>
<dataCacheClients>
<dataCacheClient name="default">
<!--To use the in-role flavor of Windows Azure Caching, set identifier to be the cache cluster role name -->
<autoDiscover isEnabled="true" identifier="SessionStateDemo" />
</dataCacheClient>
</dataCacheClients>
Based on this thread it looks like the Windows Azure Cloud Service must be a startup project to work properly. Otherwise the Windows Azure Runtime won't initialize what causes the SocketExceptions.
I'm having trouble getting IIS 7 to load this handler I've written. I'm keeping things really simple to start with. I have a Handler.cs file with the following code in it:
public class Handler :IHttpHandler
{
public bool IsReusable
{
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.Write("asdfasdf");
}
}
I have put this file in the root directory.
I want to execute this code whenever the root directory receives a request, so I have built the handler file like this:
<configuration>
<system.webServer>
<handlers>
<add name="Handler" verb="*"
path="*.*"
type="Handler"
resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>
IIS gives me the following error when I attempt to go to localhost/runt (my website root directory )
Server Error in '/' Application.
Could not load type 'Handler'.
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.Web.HttpException: Could not load type 'Handler'.
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:
[HttpException (0x80004005): Could not load type 'Handler'.]
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +11247344
System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String type) +23
System.Web.Configuration.HandlerFactoryCache..ctor(String type) +25
System.Web.HttpApplication.GetFactory(String type) +91
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +338
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +263
Version Information: Microsoft .NET Framework Version:2.0.50727.5466; ASP.NET Version:2.0.50727.5459
Try setting the type to the fully qualified namesace.
You can find the default namespace through the properties of your web application.
<configuration>
<system.webServer>
<handlers>
<add name="Handler" verb="*"
path="*.*"
type="DefaultNamspaceFromProperties.ClassNamespace.Handler"
resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>
I suspect that creating a default handler for everything using the .NET Framework will have some security risks and you should probably do further reading / consultation to make sure you aren't adversely putting your sites' security at risk.
I am converting a website over to ASP.NET 2.0, which supports .NET Framework versions 2.0 – 3.5. I am getting the following error message on a particular tab that is connected to a SQL DB. I am stuck at where this change needs to occur as I did not build this particular section of the site. Here is the error message and the Code. Any Help would be greatly appreciated.
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:
[NullReferenceException: Object reference not set to an instance of an object.]
MagicAjax.AjaxCallHelper.GetPageHiddenDictionary(Page page, String fieldName) +37
MagicAjax.AjaxCallHelper.HandleClientScriptBlocks(Page page, Boolean
reflectToClient) +17
MagicAjax.AjaxCallHelper.Page_PreRender(Object sender, EventArgs e) +238
System.Web.UI.Control.OnPreRender(EventArgs e) +8996626
System.Web.UI.Control.PreRenderRecursiveInternal() +103
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) +2496
This question already has answers here:
'Operation is not valid due to the current state of the object' error during postback
(4 answers)
Closed 8 years ago.
I have radcombo boxes on aspx page, and when I select any option from then it gives error`Server Error in '/' Application.
Operation is not valid due to the current state of the object.
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: Operation is not
valid due to the current state of the object.
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:
[InvalidOperationException: Operation is not valid due to the current
state of the object.]
System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
+2692302 System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +61
System.Web.HttpRequest.FillInFormCollection() +148
[HttpException (0x80004005): The URL-encoded form data is not valid.]
System.Web.HttpRequest.FillInFormCollection() +206
System.Web.HttpRequest.get_Form() +68
System.Web.HttpRequest.get_HasForm() +8735447
System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
+97 System.Web.UI.Page.DeterminePostBackMode() +63 System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+133
Version Information: Microsoft .NET Framework Version:2.0.50727.3634;
ASP.NET Version:2.0.50727.3634 `
From http://codecorner.galanter.net/2012/06/04/solution-for-operation-is-not-valid-due-to-the-current-state-of-the-object-error/
Issue happens because Microsoft Security Update MS11-100 limits number
of keys in Forms collection during HTTP POST request. To alleviate
this problem you need to increase that number.
This can be done in your application Web.Config in the <appSettings>
section (create the section directly under <configuration> if it
doesn’t exist). Add 2 lines similar to the lines below to the
section:
<add key="aspnet:MaxHttpCollectionKeys" value="2000" />
<add key="aspnet:MaxJsonDeserializerMembers" value="2000" />
The above example set the limit to 2000 keys. This will lift the
limitation and the error should go away.
This can happen if you call
.SingleOrDefault()
on an IEnumerable with 2 or more elements.
I know an answer has already been accepted for this problem but someone asked in the comments if there was a solution that could be done outside the web.config. I had a ListView producing the exact same error and setting EnableViewState to false resolved this problem for me.