Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Weird Server Error: Cannot execute a program.

Posted on 2004-03-26
13
Medium Priority
?
834 Views
Last Modified: 2010-08-05
I have been getting a very strange server error when I run my latest ASP.NET projects.  Both projects have impersonate=true set in the web.config file with the username and password set as my personal username and password that I use to log on to the domain.  I have set impersonation like this because I want the application to read and write files to a shared folder on another machine.

The project compiles fine but when I try to access it for the first time in IE I get the following error:

Description: An unhandled exception occurred during compilation using the CodeDomProvider 'Microsoft.VisualBasic.VBCodeProvider'. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.ExternalException: Cannot execute a program. The command being executed was "c:\winnt\microsoft.net\framework\v1.1.4322\vbc.exe" @"C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\webreports\7560c61e\3a26b9a7\wwdwm0gw.cmdline".

I get this error if I run the project on my local development machine or if I run it from our web server.  If I kill the aspnet worker process on the machine that is serving the application and refresh the page on the client, it compiles and runs perfectly.  This happens every time I make changes to the project.

Does anyone know why this is happening and what I can do to fix it?  Thanks.
0
Comment
Question by:ECSDevelopment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
13 Comments
 
LVL 1

Expert Comment

by:VBSMerlin
ID: 10689948
hi,

any reason why you are using the VBCodeProvider Class, this class is not guaranteed to be thread safe and might cause your app to be unstable. Also fron the stack trace i notice that you are trying to instanciate a report, which report generator are you using it seems to be the problem here.

my first resolve of this would be to add the ASP.Net account to the VS developer group and grant it full right over my webApp, if this doesn't resolve it make sure that the impersonated user name is set with full permissions to the webApp folder and folder where reports are located.

VBSMerlin
0
 

Author Comment

by:ECSDevelopment
ID: 10704132
I am not explicitly using the VBCodeProvider Class.  I'm not sure why that class is being used.

Also, I am not using a report generator, I just used the term Report because it is allowing people to access our reports in pdf format.

I tried your suggestions of adding the ASP.NET account to the VS Developer group and granting it full rights over the web app, and I have also made sure the username I am impersonating with has full rights to the webapp folder and I still get the same error message.

I noticed that the server and my local machine had both versions of the .NET framework.  Do you think this may cause an issue?  I uninstalled the newer version of the framework (1.1) on my local machine, so now it is only running 1.0, and now when I run the app i get the following error message:

Server Error in '/WebReports' Application.
--------------------------------------------------------------------------------

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'A required privilege is not held by the client. '

Source Error:


Line 3:      
Line 4:    <system.web>
Line 5:        <identity impersonate="true" userName="ecs\cdenison" password="mypassword" />
Line 6:  
Line 7:      <!--  DYNAMIC DEBUG COMPILATION


The web server has both versions of the .NET framework installed, and as far as I can tell it is using 1.1.  I am getting the same error message when I run my app from the web server as I was in my previous post.

Also, when I set impersonate="false" in the web.config, I get this error message:

Server Error in '/WebReports' Application.
--------------------------------------------------------------------------------

Could not find a part of the path "\\Ecs_sql\WebDocuments".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path "\\Ecs_sql\WebDocuments".

Source Error:

Line 134:                  Dim ProjectWebPath = Server.MapPath(".\Documents\") & dsData.Tables("ProjectInfo").Rows(0).Item("tblJobinfo_JobNumber") & "\TOC\"
Line 135:                  If Not Directory.Exists(ProjectWebPath) Then
Line 136:                        Directory.CreateDirectory(ProjectWebPath)
Line 137:                  End If
Line 138:

Source File: c:\inetpub\wwwroot\WebReports\BuildTOC.aspx.vb    Line: 136

Stack Trace:

[DirectoryNotFoundException: Could not find a part of the path "\\Ecs_sql\WebDocuments".]
   System.IO.__Error.WinIOError(Int32 errorCode, String str) +267
   System.IO.Directory.InternalCreateDirectory(String fullPath, String path) +453
   System.IO.Directory.CreateDirectory(String path) +180
   WebReports.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebReports\BuildTOC.aspx.vb:136
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +29
   System.Web.UI.Page.ProcessRequestMain() +724
 

Any ideas as to why I'm getting these errors and what I can do to fix them????  This is a really annoying problem, and I would greatly appreciate some help.  Thank you.
 
0
 
LVL 1

Expert Comment

by:VBSMerlin
ID: 10705280
hi,

having 1.1 or 1.0 should not affect your app. and from what see of the code you do not require to impersonate, that is if the document directory containing the PDF files are located on the same server as the webApp.

From the exception you are getting it seems that the AspNet account is trying to talk over the network, which it is not allowed, but from line 134 i see that the documents path you are looking is located on the same server (.\Documents), the better of accomplishing this task would be to incorporate the said directory as a virtual directory of the WebApp and doing a Server.MapPath(Request.ApplicationPath) and then concatinating the path of the virtual directory to it, at that point the aspnet account can take over. As a rule the webapp cannot request files outside of it's tree and therefore to grant right you must had the directory within it's giving realm.

let me know if this helps

VBMerlin

0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 

Author Comment

by:ECSDevelopment
ID: 10705332
The documents folder is actually on another machine.  I set up a virtual directory called documents in my webapp that points to the folder on the other server.  The shared folder is also set up as a network share, of which I gave my user account in the domain full access to. (I am using my user account in the domain to impersonate with in my web app.
0
 
LVL 1

Expert Comment

by:VBSMerlin
ID: 10705400
ok

do this, don't use the account to impersoante at the web.config level, rather had the virtual directory pointing to the server, and use the account to grand read right to the directory located on the remote server, this will save you tons of problem and coding.

go to IIS MMC
right click on the site name
click New
Select virtual Directory
click next
had the alias wanted ie: Documents
click Next
had the path to the directory ie \\Ecs_sql\WebDocuments
click Next
had the user name password / repeat the password in the challenge box
click Next
Click Finish

now the directory is part of the app and much easier to talk to

VBSMerlin
0
 

Author Comment

by:ECSDevelopment
ID: 10705599
That's exactly how I have it set up now.  the Documents virtual directory points to the shared folder on the other machine.  When I do Server.MapPath("./Documents") as the path to it in my app, it gives me the "Cannot find the path to ..." error message when I have impersonation set to false in the web.config.  If I set it to true using my domain username and account, it gives me the weird "Cannot run a program..." error message the first time I run each page that attempts to read or write to the shared folder.  When I kill the ASPNET worker process, it then runs fine.
0
 
LVL 1

Expert Comment

by:VBSMerlin
ID: 10706173
ok

don't do the server.mappath("./documents") that's never going to work, instead to server.mappath(Request.ApplicationPath) & "\Documents", the output of the string is actually a common directory call ie c:\intepub\www\webapp\documents, it's server side code and doesn't talk the URI way

VBSMerlin
0
 

Author Comment

by:ECSDevelopment
ID: 10706344
I did what you said, and that stores the files in a local folder at c:\inetpub\wwwroot\WebReports\Documents, but that's not where I want the files to be stored.  Is there a way to navigate into the virtual directory so that the files are stored in the shared folder on the other machine?  Thanks.
0
 
LVL 1

Expert Comment

by:VBSMerlin
ID: 10706398
hi,

i'm sorry my train of thought was stock in one place, once you have the virtual directory setup you actually don't need to do a server.mappath, the file is now located in http://webapp/documents/myfile.pdf, you can use the system.net, and the webclient class to detect if the files exist or not.

so your line 134 could read the following

dim strWebPath as string = "http://webapp/documents/" & dsData.Tables("ProjectInfo").Rows(0).Item("tblJobinfo_JobNumber") & ......

get ride of 135 - 138

again sorry for the mishap

VBSMerlin
0
 

Author Comment

by:ECSDevelopment
ID: 10706543
If I do it this way, I see that I can download or upload files, but is there a way that I can get a listing of all the files in a directory?

Also, I found an alternate solution to my problem, although I would still like to have it work the way I have it set up now.  I set up the web app on the other machine that has the shared folder for the documents. Then, I gave the account that ASPNET is running as read/write/browse permissions to the shared folder.  So now the site is running on the other machine and is using a local share to read and write the files.

If have any other help for making the site work from the original server, that would be great, but don't feel obligated to do so at this point.  Thanks for all your help so far.
0
 
LVL 1

Accepted Solution

by:
VBSMerlin earned 1000 total points
ID: 10706580
good principle, the other way and i think this might work for you is to make the share a mapped drive of the original server you should be able to talk to it that way if you want to stay in your origianl format, so instead of talking to a UNC share you would talk tot he drive letter.

well let me know, i'll do some research on my side, if i can be of any further help I'll be more than happy.

VBSMerlin

Two minds are better than one
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question