I'm writing an ASP.NET Web Forms project in Visual Studio 2013, but am having trouble moving it to my computer's IIS 7. Although the project launches successfully from Visual Studio and works properly, launching the version I put on IIS gives an HTTP 500 error: "localhost is currently unable to handle this request."
Here is my process:
Use the File System method of Visual Studio's Publish tool to publish the project to a folder on my computer.
Access IIS' Default Web Site, and set the Physical Path to the folder I published the application to.
If the project works from Visual Studio, why wouldn't it work in IIS?
I had a double entry for in my web.config, and it was causing the same issue: 500 error with no other clue.
The problem was I was submitting a Web Form Application instead of a regular Web Site. The former has additional files in it that makes it not work properly in IIS (at least, I've never been able to make it work).
Thankfully, making a blank Web Site in Visual Studio and copying the web pages over from the Web Forms application was a simple matter, and I got it working easily.
I had an entry made in the web.config
which caused this error...remove the line fixed this issue. so probably any error in web.config makes the browser to not load the server and hence the issue
:( Oops.
500 Internal Server Error
An error occurred while starting the application.
This message came out when I added database functionality to my asp.net core app and deployed it to iis. When I developed it in Visual Studio, everything went well. But after deploying, this error messages appeared.
I tried to use dotnet myapp.dll to run my app in the deploy folder, and found out it worked well. It is likely that the problem is relation to iis. I tried to add <compilation debug="true">..</compilation> to web.config, but it seems useless. What is problem are actually, or is there any other way to see the detailed error info to help find out what's happened?
Change stdoutLogEnabled="false" to true and then check the logs at stdoutLogFile=".\logs\stdout". The error(s) there might tell you something.
Check that you set up right Environment Name using ASPNETCORE_ENVIRONMENT environment variable as so use correct settings like connection string. On your machine by default you have "Development" environment.
You may use Error Handling middlewares for showing exceptions like
app.UseDeveloperExceptionPage();
Had the same issue. Here is the guide that helped me. Note, that I did not want to install the "Runtime" on the web server, but rather deploy all the necessary files as a stand alone app. Below are the steps in a more abbreviated form:
On your local PC, Determine which version to publish based on your server. I was targeting Windows Server 2008, R2 which meant i needed to publish win7-x64. Open a command prompt in your project directory and run the command below:
dotnet publish -c release -r win7-x64
This creates a publish folder containing hundreds of dlls, an .exe, and web.config located here: bin\Release\netcoreapp2.0\publish
On the web server with IIS, go to this landing page. Click the link for your desired version. Find the link for the Runtime and Hosting Bundle. Click to download and run.
Restart IIS by running this from an elevated command prompt:
net stop was
net start w3svc
Copy all of the files in your local publish folder to your desired application folder on the IIS server.
On the server, Open IIS, and create a separate AppPool and Application like normal. For the AppPool, under Basic Settings, change the .NET Framework version to No Managed Code. Make sure your Application in IIS points to your desired folder and the proper AppPool.
Test your web application in a browser.
In my case, I got this because I hadn't actually installed the latest 'DotNetCore.2.0.0-WindowsHosting.exe' on the windows server I was running it on... so it was working fine on my local machine in debug and error five hundy'ing on the server.
I had other non trivial to fix issues with the upgrade also... I'd advise avoiding it if you can.
Mark333's comment below solved my problem.
Quoting for easy reading:
"I'm using the normal publish provided by Visual Studio. And, I just
found out using the latest version of Hosting Bundle will fix the
issue. +1 on this
microsoft.com/net/download/dotnet-core/runtime-2.1.0-rc1"
I had to install for 1.1 since my app is a little older, but Hosting Bundle fixed it. In my case we deploy to a Docker image for our official environment, but when I want to do some testing locally I publish it and let my local IIS serve it up.
My problem was solved installing .netcore latest: https://dotnet.microsoft.com/download/thank-you/dotnet-runtime-2.2.2-windows-hosting-bundle-installer
https://learn.microsoft.com/pt-br/aspnet/core/host-and-deploy/iis/index?view=aspnetcore-2.2#install-the-net-core-hosting-bundle
Worked like a charm!
I had installed DotNetCore.2.0.5-WindowsHosting.exe on a Windows 2008 R2 Standard machine and encountered the same http 500 error. Logging didn't help (blank logs were generated - and Event Viewer logs were the generic ErrorCode = 0x80070002)
I had to do two things to solve my problem:
Give Read rights to the ApplicationPoolIdentity user (EG: IIS APPPOOL\AppPoolIdentityName) to the website directory and the application directory
I had to install IIS ASP Core under Server Manager (this felt weird, but it worked!)
I had the same issue.
My problem was that my connection string to db was not set in appsettings.production.json
And the internal server error 500 was to vague error message.
Changing the stdoutLogEnabled = true did nothing to me so i was not seeing any information about the error.
Make sure the App Pool has permissions to the folder where your app resides.
I experienced this issue. The problem was due to my local Sql Server instance. Remote connection were not allowed. So I manually restarted the SQL instance and my App restarted working fine.
I had similar issue after istalling dotnetcore-windowshosting using chocolatey while doing AWS ec2 instance bootstrapping.
When I checked my IIS modules AspNetCoreModule was missing.
This solved my issue. https://github.com/aspnet/IISIntegration/issues/434
I had to uninstall chocolatey package, restart machine and install it again.
Hope this helps!
In my case, I created a .NET 5 single file output, and I was getting:
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
The problem turned out to be that the EXE file was for some strange reason recognized as a virus by the protection software (CrowdStrike Falcon). Re-building without "single file output" option solved that problem.
There is an article called "Configuring IIS, ASP.NET, and SQL Server" which I highly recommend.
I followed the steps described there and my asp.net core app now communicates with my SQL database (after being published to IIS):
https://www.codeproject.com/Articles/674930/Configuring-IIS-ASP-NET-and-SQL-Server
It also happens when you install dotnet-hosting-bundle/dotnet runtime beofore IIS.
In this case re-install dotnet-hosting-bundle/dotnet runtime.
To be able to see the excetion's detail I just needed to change the ASPNETCORE_ENVIRONMENT to "Development" in the "IIS Express" profile in the launchSettings.json file. I aldo needed to create the corresponding appsettings.Development.json file to set the variables and data needed in my App. When the environment is Development net core send the detail exception by defaul. As we can read here in the official documentation.
I new to ASP.NET development and I have managed to deploy VirtoCommerce to my local machine IIS (windows 8.1) following the documentation on http://docs.virtocommerce.com/display/vc2devguide/Deploy+web+applications+to+dedicated+server .
When I tried to deploy it in Azure VM running Windows server 2012, I got the following error when I tried to run the frontend page. The dll mentioned below is definitely in the /bin folder of the store.
Server Error in '/' Application.
Could not load file or assembly 'LibSass.x64' or one of its dependencies. An attempt was made to load a program with an incorrect format.**
I followed the link
Could not load file or assembly 'LibSass.x64' or one of its dependencies in VirtoCommerce but found no luck. What did I miss on this deployment ? Any help is much appreciated, thank you.
Are you running 64 but machine and IIS Application Pool as 64 bit? If not, make sure to go to IIS and configure pool settings to run as 64 bit process. The easier approach will be to follow the guide here: http://docs.virtocommerce.com/display/vc2devguide/Deploy+from+GitHub+to+Microsoft+Cloud+Azure which will setup Virto Commerce as a website in IIS with all correct configuration for IIS. You can then update it manyally by simply uploading site through FTP if you want. You can also clone the repository on GitHub and that way your azure site will auto update on every checkin.
I was able to reproduce this error on a clean Windows Server 2012 Standard. It turned out that Libsass.Net requires Visual C++ Redistributable Packages for Visual Studio 2013. After installing the vcredist_x64.exe the error has gone.
I am facing a problem publishing an mvc webapi to a remote server. Currently i have deployed the website to the server and am I able to run the site in the windows server browser as a localhost however when i try to access it over the internet thought the public ip address i get a 404 error of file not found.
The port is open. i'm using iis 7.0 and windows server 2008.
I have checked all the bindings to the port! I tried to check if mvc is installed and all I read says that mvc comes already with iis 7 and webplatform installer says that .net 4.5.1 is installed
Any ideas how to solve this?
Just some simple ideas of how to resolve it. Hope they are usefull.
a) Check the app pool of the application. Set it to the correct .NET framework if required.
b) A very simple test I perform to see if its the app or the url.
- Stop the app.
- Place your app in a folder temporarily.
- Place a simple index.html HTML file where your app should be.
- Browse to it and see if 404 shows.
c) if its a new box and not set correctly you might need to set up IIS for Application Development. Check this Link with regards to setting it up. Expand the tree to make sure you select what you need.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Database Deployment issues
I followed the steps in this video:
http://www.asp.net/iis/videos/developing-and-deploying-in-a-shared-hosting
I just open my website on VS2010. then use the copy tool and I create a new directory and copy my web application into this new dir. the copy is done successfully but when I try to access it I get 500 for the main page which contain only some static menus and when I try to access any of my other pages it gives me a 404 error!
I tried to add some sections to my web.config to handle the errors and show me what's exactly wrong as advised before but It won't give me any details! .. also when I try to remotely access my IIS I can only see the folder of my application but I can't see any files! and the icon for my application is a normal folder, I've seen some screenshots of an IIS of a deployed website and the folder icon is converted to an application icon.
I've also tried to click on my application in IIS a right click > Deploy > Convert To Application. but it generates "An Error occurred when the request was processed on the remote computer. the server experienced an issue processing the request"!
I've been trying to deploy my website for 3 days and posted three questions with no results! :S
Problem Solved
I've tried to speak to my provider again today and an agent advised me that I need to have my application on a virtual path to deploy it as an application. and it worked.
But I marked Chris's answer as the correct one not because it's the only answer but has really stated some good points and I really appreciate his help.
Thank you so much guys :)
Well.. 404 means file not found. 404's won't be caught by the .net runtime, unless it's for a file with a regular .net extension like .aspx. 500 is an internal server error.
Things I would investigate
Can you deploy just a regular HTML file and load it?
if this works, move to #2. If not then either you aren't pointed to the right machine or you aren't deploying your files to the correct location.
Can you deploy a very simple (nearly blank and self contained) .aspx file and load it? If this works, then .Net is installed. If not, then you need to figure that out.
Can you look at the file system to see if anything is actually there? If you aren't seeing it, then it didn't get deployed.
Is the appropriate version of the .Net framework installed on the remote computer?
Basically, if your app is a .Net 4.0 app, then you need the 4.0 framework installed on the machine.
Is the app pool correctly configured for the correct .net framework version?
Regardless of whether the correct version of the .net framework is installed, you still have to configure the website to use the right version of the .net framework.
Some helpful hints. Don't deploy to c:\inetpub\wwwroot. wwwroot is a directory for the default IIS website and is usually not configured correctly. Just create another directory like c:\inetpub\myapp and deploy there. Also, make sure you disable the default website in IIS and create a new site (not a virtual directory) and point it to the correct location.
I suspect that either you aren't deploying to the correct location and/or your iis settings are bad.
Somewhere along the way on the above you ought to figure it out.