TEMP files in a hosted environment

This is an open forum for any mojoPortal topics that don't fall into the other categories.

This thread is closed to new posts. You must sign in to post in the forums.
5/13/2009 7:40:42 AM
Gravatar
Total Posts 5

TEMP files in a hosted environment

 I'm running (or better "attempting" to run) my site built with mojoPortal in a hosted environment that does not allow access to C:\Windows\Temp.  I can understand why, and I attempted to resolve (by adding tempDirectory = "somewhere in my file structure" to the compilation tag in web.config like this:

<compilation tempDirectory="d:\hosting\member\xxx\TEMP" debug="false" defaultLanguage="C#">

 

for some reason, I'm still getting errors when the site is loading indicating that it is still trying to utilize C:\Windows\Temp.  Am I missing something???

frustrated, Daniel

5/13/2009 7:50:19 AM
Gravatar
Total Posts 18439

Re: TEMP files in a hosted environment

mojoPortal does not use the windows temp directory. ASP.NET does use it for its JIT compilation and that is what you are trying to override on the compilation element in Web.config, but I doubt any hosting company is going to let you change the internal workings like that. 

I think you have mis-diagnosed the original problem. You should undo that setting on the compilation and post the error you originaly were dealing with and maybe then I can help.

Joe

5/13/2009 8:04:39 AM
Gravatar
Total Posts 5

Re: TEMP files in a hosted environment

Thanks.  I removed the change to web.config.  Here is the error (the name of the file changes after refreshing a few times):

Server Error in '/' Application.
--------------------------------------------------------------------------------

Could not find file 'C:\Windows\TEMP\f9kyc2vs.dll'.
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.IO.FileNotFoundException: Could not find file 'C:\Windows\TEMP\f9kyc2vs.dll'.

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:


[FileNotFoundException: Could not find file 'C:\Windows\TEMP\f9kyc2vs.dll'.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +305
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +1162
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +66
Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames) +5237140
Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources) +493
Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources) +53
System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources) +23
System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence) +578
System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies) +1902
System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence) +74
System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace) +105
System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace) +489
System.Xml.Serialization.XmlSerializer..ctor(Type type) +6
mojoPortal.Business.SerializationHelper.SerializeToString(Object obj) +68
mojoPortal.Web.WebTaskManager.QueueTask() +575
mojoPortal.Web.WebTaskManager.StartOrResumeTasks(Boolean appWasRestarted) +104
mojoPortal.Web.Global.Application_Start(Object sender, EventArgs e) +316

[HttpException (0x80004005): Could not find file 'C:\Windows\TEMP\f9kyc2vs.dll'.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +2723014
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +128
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +188
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +295
System.Web.HttpApplicationFactory.GetPipelineApplicationInstance(IntPtr appContext, HttpContext context) +56
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +231

[HttpException (0x80004005): Could not find file 'C:\Windows\TEMP\f9kyc2vs.dll'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8890735
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +333

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3074  

5/13/2009 8:12:10 AM
Gravatar
Total Posts 18439

Re: TEMP files in a hosted environment

If you moved an existing db up to hosting I would delete all rows from the mp_TaskQueue and mp_IndexingQueue tables, then recycle the app.

Hope it helps,

Joe 

5/13/2009 8:46:42 AM
Gravatar
Total Posts 5

Re: TEMP files in a hosted environment

Thanks, Joe!  The site appears to be working now.  It's done this before and then reverted to the errors below after a few minutes, so I'm figuratively holding my breath at this point (but it's been working through 10 minutes of steady refreshes).  

I'll send an update in an hour or so if it is still up.  

Thanks, again!  Your beer is on the way!  

Daniel

5/13/2009 2:29:27 PM
Gravatar
Total Posts 5

Re: TEMP files in a hosted environment

It dropped again (same errors as before) after being online since my last post.  I ran the delete script on the two tables again (mp_TaskQueue and mp_IndexingQueue) and the site came back up immediately.  

Do I need to just set this delete script up as a scheduled task (every minute or so), or is there a better solution?

thanks, Daniel

 

5/13/2009 2:32:54 PM
Gravatar
Total Posts 18439

Re: TEMP files in a hosted environment

To be honest. I think you should file a support ticket with yourt host if you are still seeing errors about jit compiled dlls in the temp folder. Whenever I have seen those kind of errors on a dev machine a reboot fixes it. Something is funky or corrupt down in the temp folder is my best guess.

Hope it helps,

Joe 

5/13/2009 2:47:08 PM
Gravatar
Total Posts 5

Re: TEMP files in a hosted environment

Thanks, Joe.  The feedback I got from trying to resolve this issue with the hosting company was that I wasn't supposed to be using C:\Windows\TEMP (due to it being in a shared hosting environment), and to specify a temp directory within my hosting directory.  I initially tried to accomplish this by adding tempDirectory="d:\hosting\member\xxx\TEMP" to the compilation tag in web.config (as described in my initial post).  That didn't seem to resolve the issue, but apparantly clearing these two tables does.  I'll do some additional research as to how I can specify a directory to use for jit dll compiling.  

Thanks for your help,

Daniel

5/13/2009 2:54:44 PM
Gravatar
Total Posts 18439

Re: TEMP files in a hosted environment

I think your host needs to escalate to someone who knows what they are talking about. If you are still getting the same errors about C:\Windows\TEMP\f9kyc2vs.dll or some other random dll name its a runtime issue not an application code issue. I think attempts to change the location of jit compilation is not likely to work.

If the error is different now then post a new error.

Hope it helps,

Joe

6/27/2012 10:28:57 AM
Gravatar
Total Posts 192

Re: TEMP files in a hosted environment

Hi joe, I'm having this same problem, and I did also copy a dbbackup and run it in a new shared environment.

I tried deleting rows from those tables, but errors still show up after that.

note that this error doesn't hppen all the time, it just happens sometimes.

what can I do?

6/27/2012 10:42:46 AM
Gravatar
Total Posts 18439

Re: TEMP files in a hosted environment

See if this thread helps you.

Best,

Joe

6/28/2012 5:09:44 AM
Gravatar
Total Posts 192

Re: TEMP files in a hosted environment

I tried that, but errors still happen.

(changed the location to the data folder, and asked the host to give NETWORK SERVICE full permission to the folder too.)

do you think the answer in this forum is a correct permanent solution to this error?

http://social.msdn.microsoft.com/Forums/en-us/asmxandxml/thread/cbb98d54-f4af-46ce-8729-6a5df968e9b1

7/1/2012 3:34:30 AM
Gravatar
Total Posts 192

Re: TEMP files in a hosted environment

Hi again Joe.

didn't you see the post?

7/2/2012 9:32:09 AM
Gravatar
Total Posts 18439

Re: TEMP files in a hosted environment

If the problem is caused by XmlSerialization then the thread I already posted should solve the problem and stop it from creating files in Windows/TEMP

I don't see any other useful solution on the thread you posted and I'm not sure the problem you report is even caused by XmlSerialization, if it was I would expect the solution on this thread to solve it.

The thread you posted mentions adding:

<system.diagnostics>
   <switches>
      <add name="XmlSerialization.Compilation" value="1"/>
   </switches>
</system.diagnostics>

but that can only be done in machine.config so it isn't a solution in shared hosting

Best,

Joe

7/2/2012 10:16:12 AM
Gravatar
Total Posts 192

Re: TEMP files in a hosted environment

Hi again.

I used that solution and it does avoid creating dll files in windows\temp and it does create dlls in /data folder, but the same error happens there too, dll files get deleted from the /data folder as well.

by the solution in the post, I meant:

I think you should try to call the CanDeserialize before serialization/deserialization. If it fails maybe you should create another XmlSerializer instance. I don't know if this is the best approach, but it should work.

Another workaround would be to surrond the serialization/deserialization source code with a trycatch and create a new xmlserializer if you do have a FileNotFoundException. It's a bit of a nasty workaround. I don't like it much, but it

thank you very much.

7/2/2012 11:14:48 AM
Gravatar
Total Posts 18439

Re: TEMP files in a hosted environment

The actual deserialization code in mojoPortal is like this:

public static object DeserializeFromString(Type type, string serializedObject)
        {
           
            using(XmlTextReader reader = new XmlTextReader(new StringReader(serializedObject)))
            {
                XmlSerializer serializer = new XmlSerializer(type);
              
                return serializer.Deserialize(reader);
            }
            
        }

It makes no sense whatsoever to need to change it as that guy suggested, it would look like this:

public static object DeserializeFromString(Type type, string serializedObject)
        {
           
            using(XmlTextReader reader = new XmlTextReader(new StringReader(serializedObject)))
            {
                XmlSerializer serializer = new XmlSerializer(type);
                if (!serializer.CanDeserialize(reader))
                {
                    serializer = new XmlSerializer(type);
                }
              
                return serializer.Deserialize(reader);
            }
            
        }

It doesn't make sense at all and I don't believe that would solve any problem. No-one on that thread confirmed it as a solution, and in the case of my code we just created the XmlSerializer instance there is no benefit to do it again.

As I said before we have no conclusive evidence that this code is even the cause of the problem, if it was the cause the solution I already linked would solve it.

Best,

Joe

7/24/2012 1:08:14 PM
Gravatar
Total Posts 192

Re: TEMP files in a hosted environment

Hi joe, the client was struggling with this error and I was busy and it's not resolved yet.

I will be thankful if you can help.

check this:

http://sepidweb.ir/serierror.jpg

see? the error does no happen in DeserializeFromString method. it happens in SerializeToString method!

:|       ....... ! I have no idea...!

( I was thinking about bypassing the error by using a custom error page that check the last exception and redirects site visitors to previous page, and hopefully, because it randomly happens, the visitor will not notice the error. but it does not completely solve it and also the admins will have trouble with it, because they will use pages that postback, ..... I wish there is a solution to this error.)

 

7/25/2012 8:20:32 AM
Gravatar
Total Posts 18439

Re: TEMP files in a hosted environment

Well it looks like the web.config settings for serialization is working since it is pointing to the /Data/systemfiles (assuming the httpdocs folder shown in your error is the site root) folder instead of Windows temp folder. However if you've secured the file system in the recommended way by marking the /Data folder as not executable that could cause this problem, you would need to change the /Data/systemfiles folder to be executable, also make sure the folder exists and is writable by the user that is the identity on the application pool.

You can disable the task queue but you would also need to disable the internal site search since it depends on the task queue to process the search index.

<add key="DisableTaskQueue" value="true" />

<add key="DisableSearchIndex" value="true"/>

that should stop these errors but you will have to use google or bing for site search, also the newsletter depends on the task queue for sending email so you will not be able to use it either.

Hope that helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.