v1.1.1 throws an exception at first run when uploaded at a shared hoster

Topics: User Forum
Jan 24, 2007 at 8:10 AM
Hello, I tried 2 techniques: 1) I unzip MWPSK 1.1.1. locally and upload it on the server, and try to edit it on the server at the hoster; 2) I unzip it locally, edit it locally, and then upload on the server. Both runs succesfully on my local machine, but ends with the same error on the server. I have Medium Trust CAS on the server, and cannot change it to Full Trust.

Error Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

===
Source File: f:\users\microsofttestikwspecial.com\subdomains\mwpsk\httpdocs\Global.asax Line: 12

Stack Trace:

SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
ASP.globalasax.ApplicationStart(Object sender, EventArgs e) in f:\users\microsofttestikwspecial.com\subdomains\mwpsk\httpdocs\Global.asax:12
===
Any idea ? I hope MWPSK is OK with Medium Trust.
Coordinator
Jan 25, 2007 at 8:04 AM
Hi,

Yes, MWPSK does run with medium trust! It was very important for us to make sure this works in order to be in line with what customers will find with their hosting accounts.

But in addition to medium trust you also need the permission to write to the App_Data folder. This is allowed with medium trust but the access permissions of the file system may still not allow this.

Urs

Jan 29, 2007 at 2:45 PM
Hi Urs,

I'm using v1.0.3 of the starter kit and everything was fine till last friday when my hoster (www.myhosting.com) publish a document about updating their security policy, and they warn the users with the "Full Trust" applications that it might harm their app's.
Since I know that the starter kit is running on "Medium Trust" I didn't alarm but since than my app doesn't work and when I try to get to my Homepage.aspx through the default.aspx I'm getting a Security Exception in that line:

"Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."

and the marked line is:

"Context.RewritePath(string.Format("{0}?pg={1}", Request.Path, _website.HomepageId));"

But if I go directly to the homepage.aspx almost everything working fine except when I try to Login I get the security exception as well.
When I told MyHosting support group about my problem they insist in the mail they sent me back: "From the security errors you are trying to do something against the configuration." And I didn't touch the code I only use the kit as CMS user.
what should I do? Or maybe you can recommend on other hoster with no problem to run this kit.
Coordinator
Jan 29, 2007 at 3:26 PM
Hi,

There are two possible sources for this problem:

1. The hoster does limit the security permission set to something less permissive than the standard Medium Trust. Sometimes hosters create their own permission set.

2. The "Network Service" account (default account for the worker process) doesn't have write access to the AppData folder. This sounds simple but it has turned out that it might be more complex to ensure this. The user "Network Service" not only needs write access to AppData but also "Permission to read the directory attributes" on all parent folders. We have seen such issues when hosters maintain the user data on external storage.

I don't have a list of hosters who offer proper support for ASP.NET 2.0, which this is all about. Initial guidance can be found here: www.asp.net/hosters

(I am using a Swiss hoster: www.genotec.ch)

Urs