Application runs in debug mode, but not from .exe

I have an application written in VS 2005 Beta that connects to a networked SQL database.  The application works flawlessly when I execute from within VS, but when I attempt to execute the .exe I get this:

"Application attempted to perform an operation not allowed by the security policy.  To grant this application[...blah, blah, blah]"

The message goes on to say "To allow all callers to access the data for this section, set section attribute 'requirePermission' equal 'false' in the configuration file where this section is declared."

Okay, so I did that.  Now I'm getting and Unhandled exception that states:

"The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception."

For crying out loud!  What the heck am I supposed to do now?  What else do I have to change?  I'm sure it's something simple, but there are so many hoops you have to jump through now for security's sake that it's a nightmare to figure which bloody hoop is next.

I'm all for security, but I think this is all over the top. What happened to the days when you could compile an application and expect the .exe to actually run?!?  
tsb5270Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
Where does the application execute from?  Local drive?  Network drive?  Web page?

Bob
tsb5270Author Commented:
The application is on a network drive.
Bob LearnedCommented:
There is way for .NET 2003, but I am not sure if the procedures are exactly the same:

Adjust .NET Security:

(1) Windows Administrative Tools | Microsoft .NET Framework 1.1 Wizards
(2) Adjust .NET Security
(3) Local Intranet zone to Full Trust.

Another way is to trust the assembly.

Let me know if the procedure has changed with 2005 Beta.  BTW, is that Beta 1 or Beta 2?

Bob
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

tsb5270Author Commented:
It's Beta 2 (the June CTP version).  There is no  Microsoft .NET Framework 2.0  Wizards item under Administrative Tools, just a Microsoft .NET Framework 2.0 Configuration item.  I think the procedure is now adjusted in the project on the Security tab of the properties page.  I have it set to Full Trust.
The_BiochemistCommented:
If i remember rightly in vs.net 2005 beta 2 there is a security pane in the project designer which allows you to analyse the required permissions for applications run from the intranet or internet domains. It may just be for click once, i can't remember, but it might give you an idea of which permissions to alter on the client.

more info on MSDN2.microsoft.com:

http://msdn2.microsoft.com/library/8x61d3e3(en-us,vs.80).aspx

Happy Coding!
tsb5270Author Commented:
The problem proved to be a network permission problem rather than a .NET problem.  I was not able to run the executable because the .exe resides on a network server.  When I copied the .exe over to my local machine it ran fine.  Of course, this is going to create a big problem when we try to deploy this to our customers who want to run it from a server, but I guess that's a problem I'll tackle at a later time.
The_BiochemistCommented:
You should look into using one click deployment from a web server for the scenario you are describing, it will solve lots of your problems as opposed to running the exe directly from a share for instance. It basically creates a local instance of the app from a web server and then every time the user accesses it checks are made that it is the latest version. it is even more useful if your clients use laptops for example where connectivity might not always be available.

Just a thought!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.