Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 4.0 aka C# 2010 > BOOK: Professional C# 4.0 and .NET 4
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 14th, 2011, 11:05 PM
Authorized User
Join Date: Dec 2004
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:
    server = new TcpClient("", port);
catch (SocketException)
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.

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 06:06 PM
Derive TcpClient simon.gysi@gmx.ch C# 5 October 11th, 2004 11:01 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.