ASP.NET website on Amazon cloud - asp.net

I have a asp.net web application. I need to upload the published files to AWS and get accessing it through a browser. I have downloaded S3 browser and and created my account using the access key and secret access key. Then i uploaded the published files to the desired bucket. But when i accessed Default.aspx, browser showed error :
This page contains the following errors:
error on line 1 at column 2: StartTag: invalid element name
Below is a rendering of the page up to the first error.
I just checked uploading a sample html page to that path and i could access it successfully. Is there any thing that I need to do on EC2 to get my website up??

See this answer:
It appears as if the browser tries to display what it thinks is an XML
file, since it gives an error on the second character of the first
line. So I think the file is not parsed, but simply returned as is
immediately. Check if your IIS server is configured correctly and that
it actually parses your ASP tags before returning the page.
You might have a configuration issue in IIS. Try re-registering ASP.Net with IIS on your server using the following from the command-line:
aspnet_regiis.exe -i
The exe file is located under the appropriate framework version on the server in the following directory:
C:\WINDOWS\Microsoft.NET\Framework
Also make sure the version of aspnet_regiis you use is the same as your application's app pool framework version in IIS.

Related

Start an ASP.net website from a specific folder using IIS Express via command line

I've written and ASP.net MVC web application that needs to be installed as a "normal" application (or as close to it as possible). By which I mean, I need to have a "double click on exe file and the webappp opens in default browser" behavior, or as close to that as possible.
Being used to Java, I stupidly thought that I could use and embedded webserver to run it, but after a bit of research (correct me if I'm wrong here) it seems this cannot be done (only ASP.net Core can do that, but I'm using the traditional .NET Framework) and the web app needs to be run in either IIS or IIS Express.
So, after more research, this page:
https://learn.microsoft.com/en-us/iis/extensions/using-iis-express/running-iis-express-from-the-command-line
seems to suggest that launching a site from a specific folder via IIS Express is possible, by using a command like:
iisexpress.exe /path:"C:\Program Files\MyWebsite\bin"
where the path above contains my compiled ASP.net MVC website.
This, however, doesn't seem to work. When I issue that command I get the following output:
c:\Program Files\IIS Express>iisexpress.exe /path:"C:\Program Files\MyWebsite\bin"
Copied template config file 'c:\Program Files\IIS Express\AppServer\applicationhost.config' to 'C:\Users\MyUser\AppData\Local\Temp\iisexpress\applicationhost20179188941639.config'
Updated configuration file 'C:\Users\MyUser\AppData\Local\Temp\iisexpress\applicationhost20179188941639.config' with given cmd line info.
Starting IIS Express ...
Successfully registered URL "http://localhost:8080/" for site "Development Web Site" application "/"
Registration completed
IIS Express is running.
Enter 'Q' to stop IIS Express
So basically IIS Express starts, but it's not running my website from the folder I specified, it runs some (presumebly) default empty website, called "Development Web Site". I checked some urls, and I can confirm that is not my website, but just an empty shell with no pages or anything else.
What am I missing here? How do you start a website in IIS Express via command line? Do I have to "register" the website first somehow?
EDIT:
After a bit more research, I found out I can register a website explicitly by doing:
appcmd.exe add site /name:MySite /physicalPath:"C:\Program Files\MyWebsite\bin" /bindings:http://localhost:8081
and then start it with:
iisexpress.exe /site:MySite
This however doesn't solve the problem: when I browse to the website via browser all I get are 404 errors, there's no content at all.
One thing I also must point out: since an ASP.net website is compiled into a DLL file, I don't understand how simpy registering/starting it using a path to a FOLDER would work... how would IIS Express understand which DLL to load the site from? Seems like there are some crucial pieces missing here...
After further tinkering, I figured it out. I was pointing to the /bin directory of the website. Instead, you have to point to the parent directory, the one that contains the Web.config file.
So, in my case, I changed:
iisexpress.exe /path:"C:\Program Files\MyWebsite\bin"
to:
iisexpress.exe /path:"C:\Program Files\MyWebsite"
and now it works correctly

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".

ClickOnce Error 403: Forbidden

A customer gets a 403 error when trying to install our VSTO ClickOnce application. We are hosted on GoDaddy IIS7.
"Downloading (one of our files ending in .deploy) did not succeed. System.Net.WebException: The remote server returned an error (403): Forbidden."
FWIW I've made sure all files needed for the installation are present in the remote directory. The publish from Visual Studio succeeds without any errors.
The installer is hosted on GoDaddy, and it has all the correct ClickOnce MIME types set. We didn't modify any of these.
BTW, could not find the ClickOnce error log! Searching online reveals that the log is located in Temporary Internet Files by default, but it was not there. We don't have our own custom log file location set, and we'd prefer not to set up a custom location for the customer's log if we can just grab the default one instead. It doesn't sound as though the log file provides any additional information beyond the stack trace revealed by the "Details" button in the error dialog, anyway.
Sounds like there is no read access to this file for your customers.
Try to download the file directly.

ASP.Net pages don't load on IIS 8

I'm doing application testing on Windows Server 2012 to check compatibility of our web apps (in .Net 4) and am having issues loading any ASPX page. I have tried uninstalling and reinstalling all of the .Net, IIS and ASP.Net roles from Server Manager numerous times. I also found that aspnet_regiis no longer works in Server 2012, it just gives a message to use the role/feature pages instead. I'm at a loss, has anyone else tried IIS 8 yet?
I get the following message:
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
Most likely causes:
•It is possible that a handler mapping is missing. By default, the static file handler processes all content.
•The feature you are trying to use may not be installed.
•The appropriate MIME map is not enabled for the Web site or application. (Warning: Do not create a MIME map for content that users should not download, such as .ASPX pages or .config files.)
•If ASP.NET is not installed.
Things you can try:
•In system.webServer/handlers: ◦Ensure that the expected handler for the current page is mapped.
◦Pay extra attention to preconditions (for example, runtimeVersion, pipelineMode, bitness) and compare them to the settings for your application pool.
◦Pay extra attention to typographical errors in the expected handler line.
•Please verify that the feature you are trying to use is installed.
• Verify that the MIME map is enabled or add the MIME map for the Web site using the command-line tool appcmd.exe.
1.To set a MIME type, use the following syntax: %SystemRoot%\windows\system32\inetsrv\appcmd set config /section:staticContent /+[fileExtension='string',mimeType='string']
2.The variable fileExtension string is the file name extension and the variable mimeType string is the file type description.
3.For example, to add a MIME map for a file which has the extension ".xyz": appcmd set config /section:staticContent /+[fileExtension='.xyz',mimeType='text/plain']
Warning: Ensure that this MIME mapping is needed for your Web server before adding it to the list. Configuration files such as .CONFIG or dynamic scripting pages such as .ASP or .ASPX, should not be downloaded directly and should always be processed through a handler. Other files such as database files or those used to store configuration, like .XML or .MDF, are sometimes used to store configuration information. Determine if clients can download these file types before enabling them.
•Install ASP.NET.
•Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
Detailed Error Information:
Module
StaticFileModule
Notification
ExecuteRequestHandler
Handler
StaticFile
Error Code
0x80070032
Requested URL
http://localhost:80/login.aspx
Physical Path
C:\Inetpub\WEBSITE\login.aspx
Logon Method
Anonymous
Logon User
Anonymous
Well, after fighting this issue for the last few days I reset the VM to the base snapshot that I took immediately after finishing the OS install. I followed the exact same steps that I documented during my first runthrough to install the IIS and App Development features then installed my apps and now it works. I have no idea why or how it worked this time where it didn't before, but at least it is working now.

Upload vCard (.vcf) file to IIS7 Site

I'm trying to upload a vcard file to a site i've built with ASP.NET. It's hosted on an IIS7 server.
I keep running into the "content type not allowed" error when i try to upload the file. I have write permission to the directory, I've already added the MIME type for vcards and restarted the IIS server, however it still refuses to take it.
I'm using DevExpress UploadControl and i've removed any validation from it so i am fairly certain the control is not restricting the file upload.
Any other suggestions ?
Maybe your component just allow some content types by default and new ones must be granted access manually.
Can you to debug your server side code, to see if your page code executes and to spot exactly what component are throwing up that error?
It's an HTTP error or a .net exception?

Resources