You get this error:
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.
This error can occur when your server runs Microsoft SharePoint Services. Try disabling the SharePoint service and make sure your server is running .NET Framework 1.1.
Please also review:
http://blogs.msdn.com/pandrew/archive/2004/05/09/128569.aspx
If you are not running SharePoint, then this issue reflects the security policy of your computer.
See Virtual Directory on Microsoft IIS Does Not Allow Anonymous Access for instructions on allowing anonymous access.
Check to make sure the ASPNET account has permissions to the folder containing your application. Your ASPNET user needs full permissions in order for your application to run properly.
See ASP.NET User Does Not Have Permissions to Your Application Folder for instructions on granting access permissions.
Make sure that you have followed the instructions in Part VI: Deploying Applications Into Production.
Look in the Event Viewer on the machine, specifically at the Application section. If you see multiple errors or warnings within a short period of time, look at the first one to see the root cause. Sometimes errors have a cascading impact, so always looking at the first one will give you information about the root cause.
Part VII: Troubleshooting Applications
Application Runs But No Data is Displayed