I have a problem with hosting an ASP.NET RC1 application inside IIS.
I've read through similar issues here on the site, aswell as went through official Microsoft documentation, but to no avail. I simply cannot make the app start inside IIS8 which is a must in this scenario, as I need to use it with an SSL certificate, and no relevant logs are shown unfortunately.
App is packaged under dnx-clr-win-x86.1.0.0-rc1-update2
If I try to start it inside my local VS2015, it works flawlessly. If i run the Web.cmd on the server machine from command line, app starts without any problems. However, when I try to run it through IIS, event log catches the following.
Faulting application name: dnx.exe, version: 1.0.0.20309, time stamp: 0x56e05cbb
Faulting module name: ntdll.dll, version: 6.2.9200.21815, time stamp: 0x56eaff87
Exception code: 0xc0000374
Fault offset: 0x000db583
Faulting process id: 0xae4
Faulting application start time: 0x01d1aba4b38c38e7
Faulting application path: C:\inetpub\wwwroot\approot\runtimes\dnx-clr-win-x86.1.0.0-rc1-update2\bin\dnx.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: f1f534cd-1797-11e6-9404-000d3ab185aa
Faulting package full name:
Faulting package-relative application ID:
It seems to me like it is using a wrong dnx version, but this shouldn't be possible as i published the app with:
dnu publish --runtime active --no-source
First of all thanks Clint for pushing me in the right direction.
Unfortunately I ended up spinning up a new Windows Server 2012 instance, and installing everything from the grounds up, which seems to work great at this moment. I have probably messed something when initially setting up the server, but it was a test one so no harm is done. I have a few observations for DNX to IIS publishing, which could help others with similar problems or at least mitigate at least some of the problems.
Very important steps:
If publishing from command line, publish with dnu publish --runtime active. Add --no-source when you are sure you don't need to make any quick changes to make the app work so it compiles into NuGet packages.
Try to run the app manually by running web.cmd from the publishing folder from command line. If this doesn't work, IIS is least of your problems, and you need to resolve the app startup first.
Install IIS locally on your development machine, and try to make it first work with that one, which will help you understand which issues are happening to you and how to resolve them on the real web server.
Use Event Viewer -> Windows Logs -> Application to catch .NET and HttpPlatformHandler errors during startup
Enable stdout inside wwwroot/web.config for your solution.
Battling different issues:
1. Various http 4xx and 5xx errors.
Ensure that Http Handler 1.2 is installed. If you are not sure, check the add / remove programs section in control panel, where version is clearly visible. If using a x64 system, you need to install x64 runtime
Check that you have unlocked handlers in IIS
Check that Application pool is set to No Managed code (32 bit app support was not required in my case)
2. I'm not sure I published to a good folder
Create a folder for your web app inside your wwwroot folder e.g. C:\inetpub\wwwroot\myApplicationName
Copy publishing files to that folder. Structure should be as follows:
C:\inetpub\wwwroot\myApplicationName
approot
logs
wwwroot
Create a new website in IIS and attach it to your application pool that is set to no managed code
Set the application folder to be C:\inetpub\wwwroot\myApplicationName\wwwroot
3. Event Viewer - DNX Could not write to logs folder
This is an issue with IIS permissions on the logs folder from your publishing artefacts. Right click -> Properties -> Security on the logs folder and Add permissions for the following user.
IIS_IUSRS (permissions: read and execute, list, write)
Once you do this, restart the website, and check if this issue is gone. If Event Viewer is not logging anything, check if there is a file generated in the logs folder where you should get the next troubleshooting hint.
NOTE: If you publish an app update, and you overwrite the logs folder accidentally, you will kill its permissions and this issue will return. After the initial publish, just copy approot and wwwroot, and leave the logs intact to avoid this.
4. Unable to load application or execute command 'Microsoft.AspNet.Server.Kestrel'. Available commands: web
Try to run a dnu restore before publishing manually
Ensure that you have published with --runtime active
First make sure you have httpPlatformHandler v1.2 installed. Then follow the steps and issue resolutions here. If it still is not working, I've heard some people have resolved their issues by adding a Configure1() method in Startup.cs. See the details here.
I got one of my projects working with IIS but it was a struggle. So I decided to wait until the next release. I personally don't think it's worth bothering with right now. Because it relies on dnx which is being replaced in the next release. So whatever you do to get it working, probably won't be relevant after the next release.
I have a Web Site Project, which actually runs in 32-bit enabled app pool, .net 2.0, IIS 7.5, Windows 7.
Here is the scenario that failing (but most important how it is failing). I pre-compile this site for x64 using aspnet_compiler.exe. I created new, 64bit-only app pool and I set a virtual directory where code is pre-compiled. I do this a lot, so everything as usual, only usually I test 32-bit version of code.
Once I try to access my website through url (http://localhost/mysite/login.aspx), my files in my virtual directory start to disappear. I open windows explorer and I can literally watch how files are being deleted. And then, they are gone and I get 404 response.
Has anyone seen anything like it?
Hopefully, someone will benefit from my experience.
What was happening, I took the code base which didn't contain web.config file. And the w3wp.exe [according to procmon] was deleting the entire virtual directory when web.config wasn't there. Here is how I found out - I enabled 32-bit execution and I immediately received web.config errors on the page. I went to fix it and the file wasn't there. I posted the file and now it was giving me "incorrect format" exception, which was normal since my code base was in fact 64-bit. So, I disabled 32-bit execution on the app pool and everything worked.
The bizarre behavior was that with no web.config w3wp.exe was removing entire virtual directory.
I'm hosting a web application (.Net 4.5) to a remote server using IIS 8.5. The application runs well locally and on the remote IIS, however there is a single page "/Reports/ReportsMain.aspx" that causes the error "The resource cannot be found." I made sure that the page exists.
I also made sure that the .Net version for the application pool is set to 4.0.However I noticed the following:
1- When I accessed this page remotely for the first time I got a browser "Login" popping up, although there should be no authentication here at all
2- The error page shows at the bottom "Version Information: Microsoft .NET Framework Version: 2.0, ASP.NET Version: 2.0 " although I've set the application pool to 4.0
What could be the problem ?
A couple things to try
Make sure there is not a duplicate site in IIS that is capturing the request
Restarting IIS is never a bad option
Make the web.config itself is set to target framework 4.0 and not 2.0
Usually when this happens where it works fine locally but not when deployed it always turns out to be the third item, a web.config configuration mis-match. Hope this helps!
I had this problem.
another solution can be changing the Application Pool settings:
go to the application pool related to your application. Click advanced settings. Change the "Enable 32-Bit Application"
I just ran into this response, and turns out it was caused by a StackOverflowException inside the action that supposedly could not be found. I was able to see this by attaching to IIS using the visual studio debugger. Go figure. I was doing a POST though.
As Seany84 explained in their comment above, if you have migrated from to 2.0 to 4.0, most probably your webconfig contains some tags that are incompatible with new version. In my case there was an 'applicationSettings' section that caused the problem. After removing this tag from webconfig my webservis started to run properly.
When you get
The resource cannot be found.
error on the server but it works fine locally - it could be caused by your server running out of disk space. Navigate to the server and check directory structure to see if the file exists. Also check your log messages for more details.
Folder Permissions on wwwroot.
Add IUSR with (Read & execute , Read)
Add (machine name)\ IIS_IUSRS (Read & execute , Read)
If IIS doesn't have permissions to access the file, you will be blocked
I had this problem and i fix it following way,
Make sure you don't have any errors in web config,
For finding error goto
IIS > your application >Manage Application > browse
A page will open in internet explorer,
You will find error here, fix it and restart application it will work
I was able to resolve my issue by leaving the IIS Site Bindings 'Host Name' blank.
I have tried all the answers all of them are useful. But in my case after changing these settings Restarting my machine (not just the IIS). worked for me
I built solution, created application in IIS and mapped it to the application folder. It works fine. Then I go to "Attach to Process", there are two w3wp.exe processes in list, but for one of them I get error "Unable to attach the process. A debugger is already attach." I've googled it but I can't find solution for my problem.
I have installed Debug Diagnostic Tool v2.0 and as a result I have Debug Diagnostic Service which is started automatically and attached to one of w3wp processes. After turning off and disabling this service all works fine.
So the general rule: if you get such error check processes in task manager which can capture your w3wp process.
You have 2 instance of VS and two entries in IIS running on the same application pool, for instance Both Server and Intranet are running on the same application pool.
=> Solution open IIS :
° Select the site and click 'Basic Settings' : Here you can check/select
the application pool used.
° Click on the "Application Pools" node (right under your computer name)
=> You get a list of defined application pools.
° Right click under the last one defined to open the context menu and
select 'Add Application Pool...'
Create a new name and give it the same parameters that the one that was used
by your site.
° Select the 'Basic Settings' of one of your sites and change its application
pool to the new one just created.
=> Now Server and intranet have different application pools and your can
debug the both at the same time.
Hope this helps.
For me, even after disabling the Debug Diagnostic Tool v2.0 this issue didn't fix. So, I rebuild my webservice, pushed the DLLs on the IIS and restarted the it, which fixed the issue for me.
This issue may occur when you make changes in the your web service which is hosted on your local IIS and those changes are not pushed.
Debug Diagnostic Tool v2 Update 2
https://www.microsoft.com/en-us/download/details.aspx?id=49924
Can use this link if the link provided by #mtkachenko above doesn't work
Have this in Visual Studio 2019 but after the debugger crashes on occasion. Without restarting the PC, which can be a slow affair, create a temporary second application pool and switching the site over to the new app pool in IIS also works.
Really odd - but this simple thing works for me:
Go to some file in your main project.
Go to Project menu and choose Set as start-up project.
This might seem redundant if you've already chosen that project as the start-up project before, but it seems to work.
I'm really new to setting up web servers in general. I've got IIS 8 on Windows 8, and I'm trying to set up a little site locally, while doing some development. In IIS I choose Add Site, give a name, points to a location where I have a index.html file (I've tried different locations, latest in a c:\inetpub\wwwroot\test -folder) and otherwise use all default settings. However, when I try to browse to localhost I get
HTTP Error 503. The service is unavailable.
I've verified the pool is started, and I've given IIS_IUSRS Full Control on the target folder
I've search around but not found anything that solved my issue, and there's nothing helpfull in the EventLog or in the C:\Windows\System32\LogFiles\HTTPERR folder
Could anyone tell me what's wrong?
It could be that the user identity is outdated, especially if you've tried starting a stopped app pool and the next request again fails.
In IIS, go to the Application Pools under the Server, then find the correct Application Pool for your web site, and click on it. On the Advanced Settings menu to the right, select Identity and change it and enter new user and password. Click on your Application Pool again, and select Recycle to restart it.
You can also try looking at the error message in Event Viewer, under Windows Logs, Application, Details tab.
Other answers are fine. But in my case, I was working on a Windows box that already was running some old IIS, IISExpress or any other web site. What happened is urls ACLs where reserved somehow in the system. So, you might want to check this.
Here is the console command to dump all URL acls:
netsh http show urlacl
Check what's returned here, and if anything matches the url you are testing, here is the command to delete one URL acl (for example):
netsh http delete urlacl url=http://localhost:2018/
(beware to carefully note what you do here in case it was not related to the original problem)
In my case the problem was the DefaultAppPool. I changed the "Load User Profile" to false and now it works. However, I don't know if there are side effects to this.
Further reading on setting the Load User Profile option: What exactly happens when I set LoadUserProfile of IIS pool?
Check your application's respective Application Framework Pool - it could be stopped. If it is, start it and check again.
If you're still experiencing issues you can also check out Event Viewer to find the cause of that error in order to troubleshoot more.
If the app pool is running under some specific user identity, then go to the advanced settings and update the username and password again to ensure they are correct.
If the app pool immediately stops after you start it and your event log shows:
The worker process for application pool 'APP_POOL_NAME' encountered an
error 'Cannot read configuration file ' trying to read configuration
data from file '\?\', line number '0'. The data field contains
the error code.
... you may experiencing a bug that was apparently introduced in the Windows 10 Fall Creators Update and/or .Net Framework v4.7.1. It can be resolved via the following workaround steps, which are from this answer to the related question Cannot read configuration file ' trying to read configuration data from file '\\?\<EMPTY>', line number '0'.
Go to the drive your IIS is installed on, eg. C:\inetpub\temp\appPools\
Delete the directory (or virtual directory) with the same name as your app pool.
Recycle/Start your app pool again.
I have reported this bug to Microsoft by creating the following issue on the dotnet GitHub repo: After installing 4.7.1, IIS AppPool stops with "Cannot read configuration file".
EDIT
Microsoft responded that this is a known issue with the Windows setup process for the Fall Creators Update and was documented in KB 4050891, Web applications return HTTP Error 503 and WAS event 5189 on Windows 10 Version 1709 (Fall Creators Update). That article provides the following workaround procedure, which is similar to the one above. However, note that it will recycle all app pools regardless of whether they are affected by the issue.
Open a Windows PowerShell window by using the Run as administrator
option.
Run the following commands:
Stop-Service -Force WAS
Remove-Item -Recurse -Force C:\inetpub\temp\appPools\*
Start-Service W3SVC
Or if none of the current solutions work, look in your website's directory for a file called app_offline.htm. That basically tells IIS that your site is unavailable and to show this page instead.
To fix it, either delete it or rename it to app_offline.htm.bak.
In my case, I added it while showing a colleague how to use that to prevent traffic to the site temporarily and then forgot that I did that on my box. Sigh.
Start by looking in Event Viewer, either under the System or the Application log.
In my case the problem was that no worker process could be started for the App Pool because its configuration file couldn't be read - I had included an extra '.' at the end of its name.
I resolved this issue by removing a URL reservation that matched my app directory in IIS. I had a similar (definitely not the same) issue as outlined in this article:
A Not So Common Root Cause for 503 Service Unavailable
It is possible that your domain requires the account used for running the AppPool to have batch logon rights. In which case you will see this same error message. The way you can tell if that is the case, is by looking at the System events in the Event Viewer. There should be an event saying that the account being used with the App Pool has either 'the wrong password or does not have batch logon rights'.
This is why developers quite often use IIS Express on their development machine, since it by passes the batch logon rights issue.
I ran into the same issue, but it was an issue with the actual site settings in IIS.
Select Advanced Settings... for your site/application and then look at the Enabled Protocols value. For whatever reson the value was blank for my site and caused the following error:
HTTP Error 503. The service is unavailable.
The fix was to add in http and select OK. The site was then functional again.
For my case, My Default Application Pool was offline.
To troubleshoot the problem, I checked the IIS logs located in C:\Windows\System32\LogFile\HTTPERR. Scroll down to the most recent error logs, this will show you problems with IIS if any.
My Error was "503 1 AppOffline DefaultPool"
Solution
Open IIS Manager
Click on Application Pools, this lists all application pool to your right.
Check if the application pools hosting your api or site has a stop sign on it. If so, right click the application pool and click start.
Try again to access your service from the client
Check Event Viewer - Windows - Application. If there is a red Error line made from IIS-W3SVC-WP and the message is like The Module DLL C:\Windows\system32\inetsrv\rewrite.dll failed to load. The data is the error. then you are missing some Windows Setup features.
In Windows Server 2012 go to Server Manager, Add Roles and Features, Web Server (IIS) and add the matching feature. Usually, most of the Application Development section is installed. Here is a complete list of IIS features and their associated DLL to help in diagnosis.
After going through a few iterations of that I ended on the error message above regarding "rewrite.dll". This led to a direct download and install of Microsoft URL Rewrite tool. Finally all websites came to life.
Our server ran out of disk space on Sunday afternoon which led to an application suddenly failing and returning HTTP error 502. The logs were empty so it had to be something that was occurring before IIS even did anything.
A swift look at the event viewer(WIN+R > eventvwr) exposed the issue.
It's a good idea to filter out the output of the System and Application windows to WAS since it can get pretty verbose in there.
The application depended on another one which was disabled. Therefore keep in mind an application can go down indirectly if one of it's dependent processes has gone down. We simply re-enabled the .NET application pool and our other application started running normally again.
If you have IIS URL Rewriting installed it could be to do with that. I suffered issues after a Windows 10 Update.
This StackOverflow post helped me.
Go to Windows Control Panel > Programs and Features > IIS URL Rewrite Module 2 > Repair.
i see this error after install url rewrite module i try to install previous version of it from:
https://www.microsoft.com/en-us/download/details.aspx?id=7435
it fixed my error
In my case, the problem was that another application was using the port that I had bound to my web site.
I found it by running the following command from a command line, which lists all of the listening ports and the executable involved:
netstat -b
If you have McAfee HIPS and if you see the following error in event viewer application log:
The Module DLL C:\Windows\System32\inetsrv\HipIISEngineStub.dll failed to load.
The data is the error.
Then this workaround on McAfee.com resolved the issue in my case.
Quote from the page:
Click Start, Run, type explorer and click OK.
Navigate to: %windir%\system32\inetsrv\config
Open the file applicationHost.config as Administrator for editing in Notepad.
Edit the <globalModules> section and remove the following line:
<add name="MfeEngine" image="%windir%\System32\inetsrv\HipIISEngineStub.dll" />
Edit the <modules> section and remove the following line:
<add name="MfeEngine" />
After you have finished editing the applicationHost.config file, save the file, then restart the IIS server using iisreset or by restarting the system.
Actually, in my case https://localhost was working, but http://localhost gave a HTTP 503 Internal server error. Changing the Binding of Default Web Site in IIS to use the hostname localhost instead of a blank host name.
tname for http binding
This could also happen if any recent installs or updates happened with .NET framework and/or ASP.NET. If you are unsure of what happened recently and if all your apps use ASP.NET version 4, you can try reset them by running the following commands in command prompt in administrator mode.
cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319
aspnet_regiis -i
This makes sure to install or reinstall ASP.NET 4 and updates existing applications to use ASP.NET 4 version of the app pool. It updates both IIS Classic and Integrated mode handlers and script mappings in the IIS metabase. It also recreates ASP.NET v4.0 and ASP.NET v4.0 Classic app pools, and sets .NET framework 4 to DefaultAppPool and Classic .NET app pools.
I changed the port from 80 to 8080, that's why this error occur. I write localhost/ in search bar then this error occur. My problem is resolved by writing localhost:8080/ in the search then local host open.
This happened to me on a server on our intranet. After browsing through blog posts and Windows logs, it turned out that a few days before Christmas 2015 (related to a Windows Update?) my web site application pool wanted to create a config file in folder c:\inetpub\temp\appPools, but access to this folder was restricted. This caused the application pool to be disabled.
After adding Full control to Everyone on this temp folder, I restarted the Windows Process Activation Service and everything went online again.
If I'd been a little more elegant, it would probably had been enough to grant the AppPool user full control to the folder, but I never seem to remember how the app pool name and app pool user relates to eachother...
Same thing with IIS Express 10.0 after upgrading Windows 7 to Windows 10.
Solution: go to IIS and enable all disabled websites and reinstall ASP.NET Core.
Also check the address bar and make sure the page is in the right location.
This error can be returned instead of the 404 (Page not found). In my case, it was a bad link on the page that didn't have a subfolder included.
I was having this problem when cleaning up my IIS on dev machine, and I had somehow created a virtual folder for a subfolder of my actual development web that I couldn't clear and was creating conflicts.
To clear it I had to use
C:\Windows\System32\inetsrv\appcmd.exe list vdir
and then individually remove the problem virtual directories using
C:\Windows\System32\inetsrv\appcmd.exe delete app /app.name:"Default Web Site"/{name of virtual directory}
For me the solution is to change Enable 32-bit Applications to False
None of the answers worked for me. So I'd like to share what I found after hours of research..
Keep seeing this message from event logs: The Module DLL C:\Windows\system32\RpcProxy\RpcProxy.dll failed to load. The data is the error. Turns out that dll is 64bit and cannot be loaded into 32bit process.
You can also try the following.
Right-click on the site and 'Basic Settings...'
Click on 'Connect As...'
Click on Specific User and give the new credentials.
Now it should work.
In my case, I had to change my userPass of network because company policies. So, you need to edit your AppPool:
click on Application Pools. Select your pool, 'advanced Settings...' go to 'Process Model' click on 'Identity' and Click on Specific User and give the new credentials.
This might be because of number of connections to the database. I had such a situation and so, wrote a de-constructor and killed db open connection and it resolved.
I had the same problem and found it was caused by permission problems creating the user profile in C:\Users. I gave ApplicationPoolIdentity full permissions to the C:\Users folder, started the site and everything worked, the profile must have been created properly, and my site worked as it should. I then removed access to C:\Users from ApplicationPoolIdentity.
Site wont start on local using ApplicationPoolIdentity, only when using NetworkService: "HTTP Error 503. The service is unavailable."