I have a program for class which involves C# and MVC. Upon running it in a classroom computer, the program's home page looks like this:
But, when I run the same program at home, it looks like this:
So obviously the program's resources are not loading, and I see this error when I press F12:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
For six different files, among which is the css file:
http://localhost:4321/Content/site.css
Now, I have installed IIS, so writing localhost on the browser URL bar takes me to the IIS homepage. But what could be causing this problem? Does this have to do with port forwarding (I have a comcast router, Arris TG862G which I heard sucks)? Is it possible to change the directory where the project takes the source files from to avoid this? Thank you for any help in advance
The problem is not your IIS or localhost. The errors are occurring when you are requesting certain external resources. The link http://www.gfcf14greendream.com/ise500.png does not have a well configured mime type mapping.
You either have to have someone rectify the error(s) on that server or better yet, download the resources you need in your project and access them locally.
Related
All,
I am migrating a working .Net Framework Website from IIS 8.5 on a Microsoft Windows Server 2012 to IIS 10 on a Microsoft Windows Server 2019.
The new web site is showing the error
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
As far as I can see the website on the new server is configured the same as on the existing.
Neither have directory Browsing enabled nor a default file set as is recommended by most of the posts which exist discussing this error.
I have run the following which is also recommended.
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir
The problem still exists.
I came across a post saying there might be an issue if paths referenced in the web.config are not correct but they look fine.
Has anyone got any insight into what else might cause this issue?
Are there any differences between IIS 8.5 and IIS 10 or between windows servers 2012 and 2019 which might cause this issue?
Thanks
This problem occurs because the website doesn't have the Directory Browsing feature enabled. Also, the default document isn't configured. To resolve this problem, use one of the following methods:
Method 1: Enable the Directory Browsing feature in IIS
To resolve this problem, follow these steps:
Start IIS Manager. To do it, select Start, select Run, type inetmgr.exe, and then select OK.
In IIS Manager, expand server name, expand Web sites, and then select the website that you want to change.
In the Features view, double-click Directory Browsing.
In the Actions pane, select Enable.
Method 2: Add a default document
To resolve this problem, follow these steps:
Start IIS Manager. To do it, select Start, select Run, type inetmgr.exe, and then select OK.
In IIS Manager, expand server name, expand Web sites, and then select the website that you want to change.
In the Features view, double-click Default Document.
In the Actions pane, select Enable.
In the File Name box, type the name of the default document, and then select OK.
More information you can refer to this link: HTTP Error 403.14 - Forbidden when you open an IIS webpage.
All those clowns glibly posting that "HTTP Error 403.14 - Forbidden: The Web server is configured to not list the contents of this directory" can be fixed by configuring the web site by either enabling the Directory Browsing feature or adding a default document are really not understanding what they are talking about. Anyone can copy a solution from one post and paste to another.
I'm not going to pretend I know what I am talking about but I have fixed my issue and will share what I did here to see in the hope it helps others.
I created a project (of the same type as the application I was trying to deploy) using my IDE (MSVS) in the same .Net version of the application I was trying to deploy. In this case it was creation of an MVC project in .Net Framework 4.5.
I did nothing to it. All I wanted was a skeleton.
I replaced all the files in the home directory of the web site I had an issue with, with the files of this skeleton project.
I attempted to browse to the web site and it worked successfully. Note the directory browsing was not enabled nor was a default directory set.
This proved to me that those settings were irrelevant.
Having googled around, some sites point to paths in config files causing an issue if they do not exist, eg a logging path to d:\logs where that directory was missing. It didn't fix my issue but there's no harm checking.
I stumbled across a post which talked about the roles and features enabled on the server. In Web Server (IIS)/Web Server/Application Development they had selected "Application Initialisation" and "ASP".
The Windows Sever 2012 server I was moving the application from, where it work without a hitch, did not have those selected so had not selected them on the Windows Server 2019 I was moving them to when I set that server up.
It made no sense that this would be the solution but having tried everything else I activated those two options.
Stone me if the issue was resolved.
As a check I removed those two options and the problem came back and when I reselected them it went away again.
This struck me as pretty conclusive only having thought I'd found the cause of the problem I built the website from scratch and the problem came back again.
It took a number of iterations but eventually I got there, more by luck than judgement and whatever the cause was it was due to an issue in the application which wasn't being logged in event viewer so focus on permissions to files being written to: not only that the app pool account is set up on the directories it needs access to but also that it has modify or even full control.
All those muppets robotically posting advice on configuring the web site by either enabling the Directory Browsing feature or adding a default document will no doubt copy this and paste it into their posts to claim the credit but c'est la vie.
I hope this post is of use to someone, apart from those muppets.
I have a ASPNET Core application that works fine on my machine with URL https://localhost:5001/, but not on the client's server, where the application's URL is https://example.com/subfolder/.
The problem seems to be an error in a redirect on one of the pages, where a user is sent to /something rather than /subfolder/something. I'm using relative URL's only. In the rest of the application, redirects work fine.
I was wondering if it is possible to debug the application in Visual Studio and have it run in a subfolder, preferably using Kestrel, but IIS Express might be an option too.
Update after comments While adding specifics about the problem, I found out that I was looking at it from the wrong angle. The actual problem seems to be that the application is started as https://example.com/subfolder (no trailing slash). Redirecting to ./something (or just something) will result in https://example.com/something.
(My real question therefore would be: If https://example.com/subfolder is opened, how can I redirect to https://example.com/subfolder/? I'll first try to fix this myself, maybe it should be configured in the webserver. In the meantime, I'd still like to know if subfolders can be used in debugging)
In development, it seems you can't debug your program in subfolder.
I don't recommand you to spend a lot of time to serach how to do that, and I also suggest you use IIS. Because in IIS, it supports Virtual Application, and I think it is you want.
Steps:
create a main website, and create a virtual application.
choose the project folder as Physical Path, mainsite and virtualapplication.
open vs2019 as administrator, maybe you need open it twice,and one for main site and another for virtual application.
then you can attach to a running process on your local machine.
you can start your two webapp in one port, and you can debug them.
I am testing an mvc4 site locally and have set up my hosts file / IIS so that I can run it from a test domain name. I am following instructions from here: http://ben.onfabrik.com/posts/oauth-providers
When I access it via the bound domain set up in IIS it does 'work'... but the entire contents of _Layout.cshtml are missing. All that displays is the html from the View being called.
When I run the site using the Debugger, or on live hosting it comes up as expected. So I don't think there's any problem with paths, or using ViewStart.
It's only when accessing it via the domain (bound to localhost on IIS) that the _Layout.cshtml content is missing.
Any ideas as to why this might happen and how I can resolve it? Thanks
This doesn't answer the question, but until somebody can offer a better response, it might help others in a similar position.
I had to run the site from VWD using the Debug button - that runs the app on the standard .Net Development Server, which gives you a port number.
Adding that port number to the end of my domain name made my _Layout.cshtml display.
e.g. http://testdomain.com:54829/
We're switching our MVC3 application from IIS 6 to 7.5. I'm working on setting up my local development environment on Windows 7. The app works fine for the most part, but I just discovered that ONE out of the many different MVC Areas I have doesn't work.
When I try hit an action under this area, I get a 503 Service Unavailable error back. This does not happen anywhere else in my application.
There is only one application pool for the whole website.
MVC 3
.Net 4.0
64 bit
Failed request tracing doesn't see these requests.
There is nothing relevant in the Windows application or system logs.
The area works fine under visual studio 2010 cassini, problem happens when I run it under local iis 7.5 (not express)
App pool isn't crashing or otherwise stopped
There's nothing in my ELMAH log
Everyone full control on entire tree in the filesystem security
The url is http://localhost/reports
I'm totally stumped. I can't find any evidence that IIS is even getting the request at all. Is there some other log file beside the ones I listed?
[Update]
Is there any way to view the http.sys URL reservations? I have found some talk about SQL Reporting services calling dibs on /Reports url.
I figured it out. It was due to SQL Reporting services having reserved the http://+:80/Reports url in http.sys.
I didn't actually have reporting services installed, but it apparently still reserved the url.
I fixed it with the following command:
netsh http delete urlacl url=http://+:80/Reports
Check the account / IIS -> Application Pool -> Advanced Settings -> Process Model -> Identity under which your pool is running. I had my password changed, and didn't get a log on invalid password, but rather assemlby load failure, which in turn caused the app pool to be shut off, and the "503 Service Unavailable" was given to the user.
Another solution is, I had the same problem with my http://ApplicationURL/Reports
And yes the SSRS was the issue.
A better solution for this one is
OpenReporting Services Configuration Manager.
Connect to your local service usually COMPUTERNAME\MSSQLSERVER
Go to "Report Manager URL" Option
Modify your virtual directory with another name instead of Reports.
Just remember with this change you reports for SSRS will be in the name that you defined.
Carlos
Are you using any ODBC or other components in this area that you are not anywhere else? I have experienced this error (or one similar, can't remember off the top of my head) when running the app pool in 64bit mode and the underlying calls are referencing at 32bit 'something'. You could try enabling 32bit applications in the application pool settings to see if it affects the outcome.
As mentioned before it is related to SQL Reporting services
You can follow this approach to fix this problem:
Log on to the server that hosts SSRS.
Go to Start > Programs > SQL Server 2008 R2 > Configuration Tools > Reporting Services Configuration Manager
Connect to the server in question (usually your local server)
Go to the Web Service URL section
Change the TCP port to an open port other than port 80 (81 happened to work on my server) and hit Apply
Go to the Report Manager URL section
Click Advanced
Click the entry with a TCP port of 80 and then click the Edit button.
Change the TCP Port entry to the same thing you changed it to in the Web Service URL section previously and Click OK.
Click OK again.
I am trying to get a demo site for a client setup. This is the 1st application my company is doing in MVC.NET, so I get to experience all the new things to find out (and all the headaches it'll cause).
Anyway, the site works fine locally (localhost) and on the server inside our domain. External users not on the domain however, only get 404 errors. I've tried several different settings/ config options I've found on this site, but nothing is working. I don't know if it's a web.config issue or an IIS issue, or even simply a permissions issue (though it has all the same permissions as the other sites we run with Web Forms).
IIS: v7 in intergrated mode.
Windows Server Web
Well, because you received a 404, the server is being reached okay which is a good sign. (Dealing with firewall issues at a company is always a lot of fun.)
A common problem for something like this is the use of virtual directories to host the website. For example, if the address to your site is http://example.com/MySite/, in MVC that would translate to: /MySite/View/Index.aspx. HOWEVER...if you are using virtual folders, /MySite/ may instead point to another spot on the server (e.g. C:\WebSites\MySite). If you are indeed using virtual paths, make sure you have your files stored at the correct path.
There is a troubleshooting tutorial here: http://support.microsoft.com/kb/248033
thanks for the answers everyone. Turns out it was something with our DNS routing setup with the sub-domains. It was getting rerouted to a place that didn't exist. Our IT guy finally got around to fixing it (ugh!)