[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

HomePages | What Causes A Stitch, Or What Causes Pain In The Ribs When Running
Google
Chat11.com Web Bible11.com MyBibleCenter.com

Creating a .NET CGI Console Application

See other Tech Tips (Search)

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

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 Tips)

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 www.mysleepcenter.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 Search For Web Spiders/Nephila Maculata?
6788 total hits since 10/2007
Recently accessed pages: Amazon Associates Scripts Amazon Earnings Discussion CD Utilities And Five Producers Of CD's Chat11 Gift Certificate Giveaway China Study Book Enzyte Eugenics And Diseases Of Infants February 8 2004 Art Bell Show Notes Garnet's Ebay Items How To Choose A Good Durian How To Clean Modeling Clay From Clothes How To Convert A FAT32 Volume To NTFS Laboratory Mae West Malaria Modeling Clay Leisure Clay Music Quotation Phil Henry Show Notes For February 13 2004 Phil Henry Show Notes For March 15, 2004 SEM - FAQ Science Instruments State Of Louisiana Stop Quicktime From Loading On Startup Trust Deed Investments

Elapsed:1