Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 4.0 aka C# 2010 > BOOK: Professional C# 4.0 and .NET 4
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional C# 4.0 and .NET 4
This is the forum to discuss the Wrox book Professional C# 4.0 and .NET 4 by Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner; ISBN: 9780470502259
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C# 4.0 and .NET 4 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 14th, 2011, 11:05 PM
Authorized User
Points: 138, Level: 2
Points: 138, Level: 2 Points: 138, Level: 2 Points: 138, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: McHenry, IL, .
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default HOWTO use TcpClient function within C# CGI under IIS7?

I have written a simple C# CGI executable to run under IIS7 using VS C# 2010 Express (.NET 4 framework). It takes HTTP POST data and builds a TCP Client request and sends the request to a running TCP server application running under the admin account. The application will respond back to the CGI executable and an HTTP response will be built and delivered back to the CGI client. This is running under Vista but will be moved to a Windows Server 2008.
Although I have set the usual CGI permissions etc. I am currently having system security /permission trouble when the CGI is invoked and the TcpClient call is executed:
...
Code:
 
try
{
    server = new TcpClient("127.0.0.1", port);
}
catch (SocketException)
{
    //...
    return;
}
...
What needs to be done to make this work? The System.Security.Permissions.FileIOPermission settings seem to be corrupted but I don't know where to look for the problem. Security settings interacting at muiltiple levels gets to be confusing. How can I isolate and resolve this?

The following errors are returned:

Unhandled Exception: System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.ArgumentException: Illegal characters in path. at System.Security.Permissions.FileIOPermission.HasIl legalCharacters(String[] str) at System.Security.Permissions.FileIOPermission.AddPa thList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) at System.Security.Permissions.FileIOPermission..ctor (FileIOPermissionAccess access, String path) at System.AppDomainSetup.VerifyDir(String dir, Boolean normalize) at System.AppDomainSetup.get_ConfigurationFile() at System.Configuration.ClientConfigPaths..ctor(Strin g exePath, Boolean includeUserConfig) at System.Configuration.ClientConfigPaths.GetPaths(St ring exePath, Boolean includeUserConfig) at System.Configuration.ClientConfigurationHost.GetSt reamName(String configPath) at System.Configuration.ClientConfigurationHost.get_I sAppConfigHttp() at System.Configuration.ClientConfigurationSystem..ct or() at System.Configuration.ConfigurationManager.EnsureCo nfigurationSystem() --- End of inner exception stack trace --- at System.Configuration.ConfigurationManager.EnsureCo nfigurationSystem() at System.Configuration.ConfigurationManager.PrepareC onfigSystem() at System.Configuration.ConfigurationManager.GetSecti on(String sectionName) at System.Configuration.PrivilegedConfigurationManage r.GetSection(String sectionName) at System.Diagnostics.DiagnosticsConfiguration.GetCon figSection() at System.Diagnostics.DiagnosticsConfiguration.Initia lize() at System.Diagnostics.DiagnosticsConfiguration.get_So urces() at System.Diagnostics.TraceSource.Initialize() at System.Net.Logging.InitializeLogging() at System.Net.Logging.get_On() at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port) at ConsoleApplication1.Program.tcp_client_request(Str ing op, String reg, String reg_value) at ConsoleApplication1.Program.handle_post_requests() at ConsoleApplication1.Program.Main(String[] args)

Thanks for any help.
__________________
Philibuster
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter-3 : First WCF example : need it with IIS7 alencdave BOOK: Professional WCF Programming: .NET Dev with Windows Communication Found ISBN: 9780470089842 0 March 13th, 2011 02:54 PM
Need help for ASP.Net and IIS7 skhan ASP.NET 2.0 Basics 4 June 12th, 2009 01:13 PM
Client & Server using TcpClient sankar2chat .NET Framework 2.0 0 June 4th, 2009 03:39 AM
IIS7 and Vista makintosh BOOK: Beginning ASP 3.0 2 January 31st, 2008 05:06 PM
Derive TcpClient simon.gysi@gmx.ch C# 5 October 11th, 2004 11:01 PM



All times are GMT -4. The time now is 07:20 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.