[Home]How To Create A CGI Executable That Is A .NET Console Application

Contents | (Visit Preferences to set your user name.) | Related To How To Create A CGI Executable That Is A .NET Console Application | RecentChanges | Preferences | Index | Login | Logout

Featured: Featured Stories | Picture Gallery

Book The Strange Case Of The Walking Corpse | WhatIsWiki
Google
Chat11.com Web Bible11.com MyBibleCenter.com
Search For Books About:
2Rel, ArgumentException, ExecutionPermission, FileLoadException, GenericResolve, HostSecurityManager, IsUnrestricted, PermissionSet, PolicyLevel, PolicyManager, PublicKeyToken, ResolveHelper, ResolvePolicy, SecurityManager, SimpleDotNetCGI, Tech Tips, Tips, VisualStudio
Search The Net:
Tips
Tech Tips
FileLoadException
SimpleDotNetCGI
PublicKeyToken
ArgumentException
PolicyLevel
GenericResolve
PolicyManager
ResolveHelper
PermissionSet
HostSecurityManager
ResolvePolicy
SecurityManager
ExecutionPermission
IsUnrestricted
2Rel
VisualStudio

Creating a .NET CGI Console Application

See other Tech Tips

CGI apps can simply be executables that look at their environent and STDIN for the web request, and return the web page, with headers, as output to STDOUT. It is possible to write a CGI application as a C# .NET console application.

One way to test an .EXE type CGI app is to run the application from a DOS prompt. You should see it output whatever its default page is.

However it is possible that an app that seems to run fine from the DOS prompt will generate errors when you try to run it as a CGI app launched by the IIS web server. This has happened when trying to get a simple example of a CGI written with .NET framework 2.0 to compile and run under IIS with Visual Studio 2005. One error you can get is:

Unhandled Exception: System.IO.FileLoadException?Create: Could not load file or assembly 'SimpleDotNetCGI?Create, Version=1.0.0.0, Culture=neutral, PublicKeyToken?Create=null' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) File name: 'SimpleDotNetCGI?Create, Version=1.0.0.0, Culture=neutral, PublicKeyToken?Create=null' ---> System.ArgumentException?Create: Invalid directory on URL. at System.Security.Policy.PolicyLevel?Create.GenericResolve?Create(Evidence evidence, Boolean& allConst) at System.Security.Policy.PolicyLevel?Create.Resolve(Evidence evidence, Int32 count, Char[] serializedEvidence) at System.Security.PolicyManager?Create.ResolveHelper?Create(Evidence evidence, PermissionSet?Create request, Boolean systemPolicy) at System.Security.HostSecurityManager?Create.ResolvePolicy?Create(Evidence evidence) at System.Security.PolicyManager?Create.Resolve(Evidence evidence, PermissionSet?Create request) at System.Security.SecurityManager?Create.ResolvePolicy?Create(Evidence evidence, PermissionSet?Create reqdPset, PermissionSet?Create optPset, PermissionSet?Create denyPset, PermissionSet?Create& denied, Boolean checkExecutionPermission?Create) at System.Security.SecurityManager?Create.ResolvePolicy?Create(Evidence evidence, PermissionSet?Create reqdPset, PermissionSet?Create optPset, PermissionSet?Create denyPset, PermissionSet?Create& denied, Int32& grantedIsUnrestricted?Create, Boolean checkExecutionPermission?Create)

When this error happens, the system will try to start the just in time debugger. But by default, this can not be done. Because of this, in the event view for system events, you'll see this error each time you try to start the app:

Here are the details for this error:

Explanation

If you want to allow the system to start the just in time debugger, do the following:

User Action

Verify that the user has the appropriate permissions to start the DCOM server.

To assign permissions

  1. Using Regedit, navigate to the following registry value
    HKCR\Clsid\clsid value\localserver32
    The clsid value is the information displayed in the message.
  2. In the right pane, double-click Default.
    The Edit String dialog box is displayed. Leave this dialog box open.
  3. Click Start, and then click Control Panel.
  4. Double-click Administrative Tools and then double-click Component Services.
  5. In the Component Services snap-in, navigate to Computers\My Computer\DCOM Config.
  6. In the right pane, locate the program by using its friendly name.
  1. Right-click the program name and then select Properties.
  2. On the Security tab, select Customize, and then click Edit.
  3. Add the user to the permissions list.

Now the visual studio just-in-time debugger can popup and tell you:

If you select visual studio, it will tell you:

Two of the troubleshooting tips are:

Unfortunately, this still doesn't get the program to run.

STATUS: Some kind of access rights problem in starting the app. Status: Unsolved

POSSIBLE FIX: Modify CGI app properties to give group Users "Full control" security permissions. Status: Worked for me

Other Related Links

Examples of simple .NET CGI applications:

Articles about CGI, IIS, .NET, etc

 *http://geekswithblogs.net/kobush/

Google searches:

From Tech Tips

Search for books about:

2Rel, ArgumentException, ExecutionPermission, FileLoadException, GenericResolve, HostSecurityManager, IsUnrestricted, PermissionSet, PolicyLevel, PolicyManager, PublicKeyToken, ResolveHelper, ResolvePolicy, SecurityManager, SimpleDotNetCGI, Tech Tips, Tips, VisualStudio

Search The Net:
Tips
Tech Tips
FileLoadException
SimpleDotNetCGI
PublicKeyToken
ArgumentException
PolicyLevel
GenericResolve
PolicyManager
ResolveHelper
PermissionSet
HostSecurityManager
ResolvePolicy
SecurityManager
ExecutionPermission
IsUnrestricted
2Rel
VisualStudio

Contents | (Visit Preferences to set your user name.) | Related To How To Create A CGI Executable That Is A .NET Console Application | RecentChanges | Preferences | Index | Login | Logout
Edit this bookstore.mybiblecenter.com page | View other versions (diff)
Search:
Sign up for PayPal and start accepting credit card payments
instantly.
Bobsgear - Get A Free Enterrpise Wiki Space!
Review: The Bobsgear Project was started to develop a variety of Confluence plugins. This installation of the Confluence Enterprise wiki includes flexible attachments, many Confluence plugins, personal blogs, interesting articles, and more. Bobsgear already has spaces related to politics, art and photography wiki, technical issues wiki, ediscovery wiki, health, Christian theology and Sabbath School wiki, the bible, book reviews, and quotations. Bobsgear allows free signup, and invites anyone to create a free hosted Confluence wiki space.


NEW USERS CLICK HERE! for a quick introduction to Wiki.

 

 Interested in Hemochromatosis Risk Factors?
7126 total hits since 10/2007
Recently accessed pages: 17 Year Cicada Map About Rita Aljazeer Candidate For Homepage On Your Friends Computers Effective Radiated Power Eugenic Child Bearing French Style Chicken With Apples FunnySafetyWarnings How To Compile A Java Program Johnny Depp Peter - The Apostle Who Was Hot-Hearted PolioPlus Satya Graha Seventh-Day Adventist Elder Guide To Baptism Sleep Apnea Spam Tricks - Web Beacons Stamina Stamp Collecting System Recovery CD Problems Discussion Washington Station Streetrods

Elapsed:0