how to Execute .aspx file on server - asp.net

Sir,
I have designed a website using Visual Studio using asp.net, it is successfully getting executed on localhost
I want to make the website live on my own server.
After uploading the project files on server and then checking on the link www.abc.com/project
it gives the following error:
Forbidden
You don't have permission to access /project/ on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache Server at abc.com Port 80
Note: the host is linux based server, and the website project is not having a database

Edit:
You added to your question that the host is a Linux server running Apache. You cannot run an ASP.NET application on Linux/Apache.
Prev: I'm leaving the information below for other people who might search for this problem when running IIS.
Locate the folder's physical location on the hard drive and pull up the Security settings. Depending on what operating system you are using, make sure the following have read/execute privileges (write as well depending on the functions of the site):
IIS_IUSRS
IUSR_MACHNAME
NETWORK
NETWORK SERVICE
If you still have problems, open the Web.config (or machine.config) and add
<identity impersonate="true" />
in the System.Web node.

Related

HTTP Error 500.19 - Internal Server Error 0x80070003 Cannot read configuration file

I'm getting the above error when I publish my application and move it from development to production server. Below are the error details.
Detailed Error Information
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x80070003
Config Error Cannot read configuration file
Config File \?\C:\inetpub\wwwroot\WorkmenCompTest\web.config
Requested URL http://localhost:80/wictest
Physical Path C:\inetpub\wwwroot\WorkmenCompTest
Logon Method Not yet determined
Logon User Not yet determined
This website used to work previously but recently the published version stopped working due to this error. As far as I can tell, the only change was installing iTextSharp and iTextSharp xmlworker through nuget.
I have tried, without success:
giving modify permission on the site folder to Everyone
checking the web.config file, and using an older version of the web.config file (from when the site worked).
uninstalling iTextSharp and iTextSharp XMLWorker
The project still runs without issue from Visual Studio.
This is solved. The error was caused by the folder name not matching the path for the virtual directory. Oh wow I feel dumb.
Check the applicationhost.config file under - .vs\lpsWeb-UI\config folder of your application root.
Under sites section of the config file check what the physical path points to.
If you modify those you should be able to fix the issue.
This is because of different physical path in the IIS.To change the physical path of application content
You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.
User Interface
To use the UI
Open IIS Manager. For information about opening IIS Manager, see Open IIS Manager (IIS 7).
In the Connections pane, expand the Sites node and click to select the site in which your application runs.
In the Actions pane, click View Applications.
On the Applications feature page, select an application from the list and then click Basic Settings in the Actions pane.
In the Physical path box, change the path of the application content.
Click OK.
DefaultAppPool application pool runs under the Network Service account. This account is local to the computer and this account does not exist on another computer. Make sure that you configure the DefaultAppPool application pool to use an account that is a domain user. Then, you can use the same account on the WorkmenComp file server. Alternatively, you can create a workgroup account on the WorkmenComp file server.
I am getting this HTTP Error 500.19 error when I am giving physical path as Z:\App_Live in IIS
Instead of using z:\ ,
I used network path \\server\share\live_folder in the IIS physical path – something like this \\server\share\wwwroot\inetpub\wwwroot
Also you may need to specify username/password in "connect as".

IIS 7 not showing virtual directory mapped to another machine

I have an issue with IIS7 when mapping virtual directories to another machine.
This is my setup:
my Web APP is running on the web server (let's call it WEBSERVER). Windows Server 2008, IIS 7.
I got some assets/images in an assets server (let's call it ASSETSSERVER). Windows Server 2003, on the C:\Assets folder, shared as \\ASSETSSERVER\Assets
Servers are in a workgroup, not a domain. This is something beyond my control, which I can't change.
Following the recommendation of our network team, I configured the app pool to run under the user WEBSERVER\portaluser
In my web app, I define a virtual directory. I map it to \\ASSETSSERVER\Assets. In the log in credentials, I specify the user ASSETSERVER\assetsuser (which exists). The 'Test credentials' buttons show that i am authenticated OK and that I have authorisation.
At first, I got a 500.19 error telling me I could not log in. This post revealed the solution: I had to create a WEBSERVER\assetsuser user with same password (counter-intuitive, but it worked).
After that, my assets still refuse to display. I now get a message similar to this:
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: An error occurred loading a configuration file: Failed to start monitoring changes to '\\ASSETSERVER\assets'.
Source Error:
[No relevant source lines]
Source File: \\ASSETSERVER\assets\web.config Line: 0
I have done some extensive googling, and I have tried the following:
Modified the local policy to allow WEBSERVER\portaluser to impersonate other accounts after login, as suggested here (it's for Windows 2000 Server but it was worth a try!)
Added permissions to everyone to the \\ASSETSSERVER\assets, as indicated here (bottom answer)
Added read/execute/list permissions to the c:\ drive in ASSETSSERVER to the ASSETSSERVER\assetsuser user, as suggested here (method 3)
I edited the registry key to stop IIS from monitoring the folders for changes, as indicated here (the writer claims that it's not related to IIS but I am quite certain that IIS does monitor the folders for changes in web.config)
I have configured allowsubdirconfig="false" in applicationHost.config as indicated here
None of these solutions have worked, and I am running out of ideas of what to try. It seems like I'm so close yet so far. Any suggestions?
After several of work I found the solution to this issue.
It was as simple as creating a user called "portaluser" (the same as my app pool identity user) in ASSETSSERVER.
This is counter-intuitive: I explicitly told IIS7 to connect to ASSETSERVER as the assetsuser server, but it was still using portaluser to check for the existence of web.config (and monitor for changes).
Having seen that, I decided to use the same account to run the app pool and to connect to the remote virtual directory. I just used 'assetsuser' instead of 'portaluser'
Hope this helps

IIS 7.5 - Setting up a Virtual Directory for a file share on another domain

I have a Windows 2008 R2 server running IIS 7.5. I'd like to set up a virtual directory for my website to allow the download of video files from a file share on a server in another domain. I have a domain username and password that allows me to access this file share. However, when I try to setup the virtual directory in IIS, I get the following error message:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Module: IIS Web Core
Notification: BeginRequest
Handler: Not yet determined
Error Code: 0x8007052e
Config Error: Cannot read configuration file
Config File: \\?\UNC\z27ar1cfvs004.abc.se\video$\web.config
Requested URL: http://localhost:8080/Video
Physical Path: \\z27ar1cfvs004.abc.se\video$
Logon Method: Not yet determined
Logon User: Not yet determined
Weirdly, I can hit Explore on my virtual directory and IIS will launch Explorer showing me the files.
For my site's authentication settings I have Basic and Windows authentication settings enabled.
Here are the things I've tried unsuccessfully:
Changing the Connect As... user for the site to use the domain user credentials
Changing the Connect As... user for the virtual directory to use the domain user credentials
Changing the Application Pool identity for the website to use the domain user account credentials
Creating a local user account on the IIS server with the same username/password as on the domain server, and trying all 3 steps above again but only specifying the username rather than domain\username
Changing the Managed Pipeline Mode: neither Integrated nor Classic makes any difference
I've Googled until my eyes have gone blurry and spent hours trying many recommended suggestions but all to no avail.
How can I solve this problem?
I have found a couple ways around this, depending on what your problem is:
Actually make a web.config file in the shared directory.
Make a <location path="video" inheritInChildApplications="false" /> element in your main web.config to specify that the virtual directory is not allowed to have web.config settings override its parent.
Set up a real directory in your website that does have a web.config in it, and use the URL Rewrite tool to make a set of rewrites to the actual content.
If you have written a custom HTTP Module that is enabled for the site, turn it off for that directory. For instance, if the module does not have to run on static files, add precondition="managedHandler" to its settings in web.config or applicationHost.config.

Windows Server 2008 R2 + IIS 7.5 - Resource cannot be found

I have migrated our company web apps from Windows Server 2003 to Windows Server 2008 R2. The are all .Net 2.0 classic web apps. They all seem to work fine, except when accessing any resource with a path starting with /Reports/...
In one app the physical path on disk is c:\Websites\app_name\WebService\Reports... In this reports folder PDF files are dynamically generated and written to disk. They can be accessed via a URL such as this:
http://domain_name/Reports/xxxx.pdf
where /Reports is a virtual directory mapping to the physical path above. This worked fine on 2003 server & IIS6 but on IIS7.5 & 2008 R2 I keep getting the following error:
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Reports/xxxx.pdf
I have another web app that generates the reports dynamically and streams them directly to the client browser for saving to the local disk, rather than being written to disk on the server. Similar to the above example, the page that generates the report is found under path as follows:
/Reports/Viewer.aspx
In this case there is no virtual directory being used. The URL referenced in the browser is:
http://another_domain_name//Reports/Viewer.aspx
Once again I get the same error message as above... HTTP 404 - The resource cannot be found.
I have tried all the permission settings under the sun to try and get it working but to no avail. I've use built in accounts, created new accounts with permissions from very minimal right up to full admin rights. I've also played with the new AppPool Identities with no success. It doesn't seem to matter what permissions I set specifically on the directories, or the accounts configured for the app pool or basic settings on each website itself.
Once thing I have discovered though, is that whilst the browser is getting the HTTP 404 error, there is no record of this request appearing in the IIS log files for each website!! This is really confusing me, as I would definitely expect to see a failed 404 log entry on the requested resource.
Something else to note, I'm running SQL Server 2008 Enterprise on this machine with Reporting services installed and enabled. It's a stretch, but could there be some contention over the /Reports path in my websites vs something else running on the machine? I'm using different bindings/host headers for each individual domain and website running on the server.
Check Reports folder conflict. And remember, Google is faster than SO.
IIS gives 404 errors for more than just File Not Found these days - so it doesn't give away too much to attackers. Have a look at the event log (application), and also try accessing it from the server itself.
The other thing to check is that your IIS app pools are correctly configured - especially with the correct pipeline mode and .NET framework version.
At a command prompt, type:
netsh http show urlacl
See if there are any bindings with /reports/ --maybe a left over from a SQL Server Reporting Services install?
v/r
BK

iis7 website application not working

i have a website of aspx on IIS7 and inside it is one directory which i have created into an application. It is the exact same setup as in another computer. the same code works fine there. it does not open the application here. i get a 403.1 error when i browse application by itself.
what are the palces that i can check that it is going wrong? any ideas?
403.1 is a security error, it is permissions.
HTTP 403.1 Forbidden: Execute Access Forbidden
Make sure the NETWORK SERVICE account has execute permission on that directory.
In the IIS Manager under the application's basic setting you can test your settings.

Resources