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.
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.