Random HTTP Error 403.14 - Forbidden [duplicate] - c#

This question already has an answer here:
.cshtml files not working IIS [closed]
(1 answer)
Closed 8 years ago.
Randomly while coding an ASP.NET MVC site I started getting HTTP Error 403.14 - Forbidden errors, and when going to specific pages ("/Views/Default/Index.cshtml"), I get
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: /Views/Default/Index.cshtml
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.32559
Which I guess means at least ASP.NET is being loaded, but why won't it recognize the page? I've tried so many reccomendations online, even went as far as removing the entry from IIS Express, then re-adding it through VS, copying the web.config from a working site to it, etc. Nothing seems to work - and it's only this one site. If I set directoryBrowse to true, I can get so far as a listing of all the pages & directories in my root. I can visit any of the directories except /Views/, which throws the same Resource can not be found error as above. I've also added directoryBrowse as true to the Web.config in /Views/, but to no avail.
Running the recommendation # http error 403.14- forbidden returns:
Microsoft (R) ASP.NET RegIIS version 4.0.30319.32559 Administration
utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation. All rights reserved. Start
installing ASP.NET (4.0.30319.32559). This option is not supported on
this version of the operating system. Administr ators should instead
install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Win dows
Features On/Off" dialog, the Server Manager management tool, or the
dism.e xe command line tool. For more details please see
http://go.microsoft.com/fwlin k/?LinkID=216771. Finished installing
ASP.NET (4.0.30319.32559).
I'm on Windows 8 with Visual Studio 2013 preview, and this has been working ever since about an hour ago, where it randomly started happening. I have a Global.asax file, and everything seems to be right (though obviously there's something off). I've getted the latest checkin to a new folder and ran from there, same problem. This is only one site, a site that was working perfectly just two hours ago. The only thing I can think of was that I was editing the routes when this happened, but I've changed the routes right back to what they were before and I'm having the same problem.
I'm at a complete loss as to what's happening, can anyone provide any kind of guidance? I'm willing to try/do/test whatever you need, I'd just like to figure out what's happening. Thank you so much, hopefully someone can figure out what's happening (and sorry about the lack of info on what I've tested and stuff - literally everything I saw in the past hour and a half of searching I've tried).

I really, really hate it when that happens - after an hour or two of searching, I find the answer seconds after posting on SO -.-
Anyways, I had to add HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents
I'm still at a loss to explain how this randomly happened - I wasn't editing anything close to web.config when the error started - if anyone could provide some insight into that I'll accept their answer.

I know this was asked a year ago, but I just had this problem and I just found the reason for it.
I don't have an IIS Server running in my computer so I can`t change its configuration. When I debug my code, it seems Visual Studio 2013 runs a server of its own for debug purposes.
Anyway, I also started getting these random HTTP Error 403.14.
In the Solution Explorer Right Click on your project and choose Properties.
in the Properties Window, go to Web and you`ll see it is defaulted to Start Action at Current Page.
The reason debug sometimes work and sometimes does not is because sometimes you have the correct asp page selected at the time you press debug button, and sometimes you are at the wrong asp page. That`s all.

Related

C# ASP.NET TempData was working but now it isn't on 2 of 3 computers

I'm working on a .net Core MVVC project devloped in VS Community 2017 and using IIS Express 10 and I'm having issues with TempData not working on two of the 3 computers I develop on. At one point it did work on all three.
I use TempData to store info during redirects and then transfer TempData to ViewData to display on the View page. I had issues with something (I don't remember what it was now) and was getting help from a co-worker and during his troubleshooting a box popped up and said something about SSL and I don't remember what he clicked but since then TempData stopped working. The one thing I think he did do differently than me was along the top in the Debug area, he clicked the IIS Express dropdown and chose the project name option instead. TempData now shows up as null after the redirect. When I open up the project on my home computer, TempData works with no issues. I have a 3rd computer I do some development on and it used to work on that until the SSL box popped up on that as well and it stopped working. I'm guessing that it's redirecting to the page I want but it's making a pit-stop somewhere along the way and the data is lost.
I tried uninstalling and reinstalling both VS and IIS Express with no change. I also tried deleting the .vs folder in the solution with no change. I tried clearing out the websites using the IIS Express command in the command prompt. I also tried it in both Chrome (where it used to work) and Internet Explorer with no change. I've tried running it with debugging and without debugging with no change.
So, TempData no longer works on two computers (both Windows 10 if it matters) and my home computer (Windows 7) works just fine. Anyone have any ideas?
by close look to your question, at first
"a co-worker and during his troubleshooting a box popped up and said
something about SSL and I don't remember what he clicked"
mybe your co-worker enabled ssl on development environment and after run the project you have to trust local IIS certificate.
I think you have to config cookie for using SSL for example <httpCookies requireSSL="true" /> or you can disable SSL for development and every thing gonna be OK.
for sure you can check that in home computer your URL have HTTP and in other two computers the URL starts with HTTPS.
On the other hands I suggest you to compare the web.config structures.
I found the answer finally at https://github.com/aspnet/Mvc/issues/8233
To fix the issue, I modified my Startup.cs file so that app.UseCookiePolicy(); was placed after app.UseMvc();. I don't know why it only affects one of my computers but it fixes the issue.

IIS Express 'The specified port is in use' Visual Studio 2015

Apologies about the long message, but I thought I should let you know what I have already tried.
I've very recently started learning C# through Visual Studio and all was going OK until about three weeks ago. I clicked on the button with a green triangle which did the usual thing of launching the internet page, but the site never loads. I then noticed there was an ISS Express notification which brings up the following (can't figure out how to get my cropped screen shot on here):
'The Specified port is in use
Port 49665 is already being used by process "svchost.exe" (process ID "2112")
Recommendations
Try switching to port other than "49665" and higher than 1024
Stop the application that is using port "49665"'
I have managed to locate the svchost.exe on my computer and it is in the system 32 folder. There doesn't appear to be an option to stop it, and I am worried deleting it will break my operating system (I did click delete to see what happens and got an error saying I need permission from trusted installer to do this, but didn't go any further). When I open task manager and look through all tasks, including 'background tasks' and 'windows processes' and can't see it anywhere
I have tried to follow the advice in this discussion:
IIS Express Web Server Port Is In Use
But I cannot fully understand where the solution was- I don't think I have anything called ISS installed, however there is a Local ISS when I go to 'file', 'open website', which I found through the following:
Why and how to fix? IIS Express "The specified port is in use"
I did as the answer marked 21 (with the green tick) suggested and restarted my computer (as one of the comments suggested) however my problem persists. There is no longer anything under 'IIS Express Sites'
I have closed all browsers then tried, restarted and then tried, still no luck
The third answer (7) I really don’t know how to do this (I don’t know what solution they are referring to), so if this is a potential solution I’d be happy for further instructions
The answer marked with a 5 about netstat -aob helped me locate a task called ‘service host: local service (network restricted) (6)’. Trying to terminate this task brings up an error saying that by terminating this task Windows will become unusable- so I assume this is why I couldn’t delete the above. The final part of this answer about elevated access I don’t know what this means or how I would do this.
Closing visual studio and restarting as an administrator doesn’t fix the problem.
I only have Edge and Internet Explorer and I have ended these via task manager whenever I have tried to resolve this problem, but it persists
I tried the answer at the bottom, but was not able to locate the folder IISExpress, maybe this is part of the problem?
Any suggestions where I might be going wrong with the above, or any further advice on how to progress some of the things above, or any new ideas will be welcome.
Thanks for the suggestion Methodman. After much digging I found the solution you suggested here (change the port): How can i change IIS Express port for a site
The answer provided provides excellent instructions with a step by step guide on how to change the port
Just changed the port number until I got one that worked :)
Ed
It is an old post but just in case someone having the same issue recently; I tried many things including removing websites, running VS in administration mode. Nothing worked. Then I finally changed the port which finally worked. Right Click on project. Go to Web on the left menu. And change the port number at the end of the project url to whatever you want. I changed it to 50645.

Browser opening, but failing to load localhost page--Selenium, MVC, C# .NET

I am starting to write tests for a project that is in its 8th agile sprint. I was brought on the team about one week ago.
Yesterday my Selenium tests were passing against the git master branch. I was accessing the http localhost address, opening it, running a test, and then closing the browser all from the Selenium code.
My team changed the access (somehow, don't quite understand) and the http localhost address changed. This was yesterday evening. Pulled the new code this morning from git.
I found the new address, and replaced it in my localhost constant. Ran the tests. Now the tests open the browser, no localhost info is entered into the url, test times out, test fails. All I changed was the localhost address.
When I just run start from the Visual Studio ribbon start button, the web app will open two windows in the browser (Firefox default). The team lead says that both windows are needed right now.
I am fairly new to Selenium (1 month and learning) and very new to .NET/Visual Studio/C# (day 4).
Researched the issue, only thing I have found that might make sense is creating an ASP.NET HTTP Module-- And I have read up on it, but don't know if it is THE solution.
If anybody has any other ideas, please let me know.
thx
a
EDIT : CODE
string URL = "http://localhost:54879/"; //unable to connect
....
driver.Navigate().GoToUrl(URL);
Had our local Microsoft guru look at what was happening. Tests run/console connects if I run after selecting start without debugging. I am v. new to Visual Studio, so I guess it was set up wrong in my tray and this makes it run properly.
In my case, the problem was that there was i needed to first run the programme without debuggen ( Debug > Start without Debugging).

MVC 3 Application on Server always gives 500 error

I am bin deploying a MVC 3 site... it works fine on our 'Staging' server, which "theoretically" mirrors our "QA" server. However, when deployed to QA, it just gives a 500 error when trying to access it from the web browser. We've turned detailed errors on in the web.config, turning off friendly http errors in IE, but nothing.
Any suggestions on what we might check for? I've already verified that .NET 4 Client & .NET 4 Extended are installed on the server. I need to compile a checklist of possibilities. Scratching my head hard on this one...
UPDATE:
I noticed one oddity here, running the powershell command:
test-path "$<Env:ProgramFiles(x86)>\Microsoft ASP.NET"
returns false. As I said before, .NET 4 (Client & Extended) are installed, but nothing else. I find this a little suspect...
Log into the server's desktop and open the web-site from the browser there. You should then see the actual exception details.
This is going to take some troubleshooting on your part.
But, I would check the following, it sounds like it involves one of these guys:
web.config
machine.config
make sure all .dlls are installed (check the GAC)
make sure your IIS pool isn't wrong version
These are only a few off the top of my head. Hope it helps.
Agree with #Andrew, knowing the exception would really help.
Just to make sure, you've tried setting the customErrors element in your web.config to Off right? This way the exception details will show everywhere instead of a HTTP 500.
Try changing the AppPool that your site uses is set to .NET 4 Integrated
You could also try running aspnet_regiis.exe to re-register .NET with IIS.
This sounds like customErrors and httpErrors setting issue. Also check IIS permission/trust levels are configured properly.

Find out what is causing problem in IIS7

We have a C# web application, and the latest deploy doesn't work on our Windows Small Business Server 2008 (IIS7). The exact copy of that site runs fine on my Windows 7 machine (IIS7.5). The previous version and other builds still work on the Server 2008 R2 machine, but this itteration doesn't.
I've checked the W3SVC logs, but no requests are logged. I've checked the eventlog for errors, but no errors are logged. I also checked in fiddler, but the request just doesn't get a response as far as I can tell (Result column remains -)
When you open the url, the browser will just keep loading (no timeout).
Is there anything else I can check or enable to debug this IIS7 behaviour?
Thanks in advance,
Nick.
UPDATE
I published the application again & created a new site in IIS, and this new version works. While my the immediate problem is solved at this time, I would still like to know how to debug IIS7, see how it works & why it would keep loading infinitely.
First, I would drop a regular .html file into the sites directory. Then I would have a browser request that specific static file. This would bypass the .net engine and should be logged.
If for some reason it doesn't work and/or isn't logged then there are other things to check, let us know.
Assuming that it does serve the file and you are pointing to the correct machine then inspect your global.asax file and remove any type of error handling you might have. Also turn off the custom errors section of your web.config. Both of which could result in the server essentially spinning off into nothingness if improperly coded. If you have any type of additional threads you are spinning up on access, then see if you can turn those off or add additional logging.
Next, look in the HTTPERR logs to see if you can identify what's going on. These are located at
%SystemRoot%\system32\LogFiles\HTTPERR\httperr*.log
Info about this log file is at: http://support.microsoft.com/default.aspx?scid=kb;en-us;820729
If your app uses ADO then there is chance that depending where the build occurred on Windows 7 or not and whether SP1 is installed or not (at the time of the build) that your build is broken by some Micorsoft ADO-update contained in SP1 (see http://www.codeproject.com/Articles/225491/Your-ADO-is-broken.aspx).
If no requests are logged in the W3SVC logs then it probably means that IIS is not recieving the request at all - likely due to firewall configuration or similar.
You should diagnose why IIS is unavailable (for example by attempting to serve some static content) and then try again.
Try these:
re-register asp.net runtime with your IIS7
make sure the asp.net extension for the correct version is set to Allowed in 'ISAPI and CGI restrictions' in your IIS

Categories

Resources