1
The given key was not present in the dictionary - only on 2008 R2 but works in Cassini
Problem reported by MarkT - 3/31/2015 at 7:32 AM
Resolved
Hi
 
I have a Visual Studio 2013 project with a reference to FileUltimate.dll and the control added to a page.  When I run this in debug on my development machine (using the Cassini web server built into VS 2013) the page loads fine and the FileUltimate control starts.
 
However when I run this same project on my proper Windows 2008 R2 IIS 7.5 I get the exception:

The given key was not present in the dictionary

The stack trace shows the error occurring here:
 
[KeyNotFoundException: The given key was not present in the dictionary.]
   GleamTech.Web.HttpHandlerRouteHandler`1.GetUrl(String pathInfo, Boolean usesSession, String routeName) +367
   GleamTech.Web.ControlBase`2..ctor() +198
   GleamTech.FileUltimate.FileManager..ctor() +18
 
This is the trial version I am trying to verify it will work in our environment.  Any help would be much appreciated.
 
Many thanks in advance

14 Replies

Reply to Thread
0
Cem Alacayir Replied
Employee Post
Strange, it seems the DLL could not run PreApplicationStart method to register the handlers thus the error occurs.
Is this a regular ASP.NET Web Application project or a ASP.NET Web Site project? If it's a Web Site project, maybe precompilation occurs and FileUltimate detects it's in development environment and thus does not run PreApplicationStart method.
 
 
Also do you run the compiled project directly on Windows 2008 R2 IIS 7.5 or do you run it with Visual Studio 2013 targeting IIS in project settings?
0
MarkT Replied
Thanks for the info.  In order to try and make the PreApplicationStart method fire I tried restarting the app pool, then a full iisreset.  Neither worked; the error stayed the same.
 
There is no code in the App_Code folder.
 
I removed and re-added the reference to FileUltimate.dll, in case for some reason this would help, it did not.
 
Will see if I can get anything else to work tomorrow...
0
MarkT Replied
I have got this working now.
 
I did not figure out why the PreApplicationStart method in the referenced assembly was not being called at the proper time.  However if I add the following line:
GleamTech.FileUltimate.PreApplicationStart.Run()
 
To my own applications startup method, everything works fine.
 
So rather than a fix, a workaround.  Thanks for pointing me in the right direction.  I just need to finish testing then hopefully we can use your product in our app! :-)
 
Thanks
 
0
Cem Alacayir Replied
Employee Post
Yes, for now you can use that workaround. We will still investigate this issue, fix it and let you know. I suspect it's about HostingEnvironment.InClientBuildManager property returning true in your application even when you run it on IIS. So maybe the PreApplicationStart is actually called but at the time that property returns true so the method returns without doing anything. That's why I asked you the type of your project.
0
Cem Alacayir Replied
Employee Post
Hi Mark,
FYI, we released 4.5.2.0 today and I think it will solve this problem. We improved the way and the timing of how FileUltimate is initialized. So you should not need to add any method call to your applications startup method. By the way that method is removed, there is another method now but I am not writing it now in the hope that you will never need to use it. Let me know.
0
Brian Pautsch Replied
Project: ASP.NET Web Forms
 
I have a homegrown CMS and dynamically load routes and they can be refreshed anytime (not just in Application_Start). I see there are 4 loaded by GleamTech. When I refresh the rules, I first clear them. How can I reload the FileUltimate v4.7.1.0 routes?
 
0
Brian Pautsch Replied
I did a quick API search...should I call this after "routes.Clear();":
GleamTech.FileUltimate.WebActivationModule.PreApplicationStart();
0
Brian Pautsch Replied
That didn't help. The routes didn't load. Please advise.
0
Cem Alacayir Replied
Employee Post
Yes that method will not work as it's designed to run only once. How about you make a backup copy of the first 4 routes added by FileUltimate before you call routes.Clear() ? Then you can re-insert these routes after clearing.
0
Brian Pautsch Replied
Seems hacky, but I ended up grabbing the first 4 routes, then cleared routs and finally reinserted them.
0
Cem Alacayir Replied
Employee Post
No, it's not hacky at all, this is exactly what I suggested. However for convenience, in the next version we may expose a public method to re-insert routes which you can call right after you clear the routes.
0
Brian Pautsch Replied
I'm sorry if the word hacky offends you, but it's just that. Grab the first 4? What if the next release has 5 or 6 routes? Should I only grab "Gleamtech" routes? A method where your team controls the logic makes a lot more sense.
0
Cem Alacayir Replied
Employee Post
Your CMS is hacky, it should iterate the routes and update only the required ones and not clear all routes : ) Just kidding we will provide a public method.
0
Cem Alacayir Replied
Employee Post
Ok I have emailed you an hotfix (v4.7.1.1) which now exposes ControlContext.RegisterRoutes method. You can call this method to re-insert routes automatically.

Reply to Thread