Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Running Windows 10 Pro workstation. New clean install. Built a small 2-page brochureware site which tested OK within Visual Studio 2015. I’m now trying to get IIS server to work so I can test from another workstation on my lan. I’m an IIS newbie and the setup seems a bit byzantine. I can get IIS to serve a simple .htm page from another workstation, but nothing doing with MVC.

Here's how IIS is configured:
Anonymous Authentication enabled
Credentials set to “Application Pool Identity”
Application bindings set as http: port 80, https: port 443

Project properties:
Start action: current page
Servers:
Apply server settings to all users – checked
Local IIS – Project url = http://<wkstn name>/<site name>
Override application root url – unchecked
Package/Publish Web]
Include IIS settings as configured in IIS – checked
No resource file
No settings file
Published using file system to c:\inetpub\wwwroot\<application>
Following code in global.asax in order to force all pages to https:
protected void Application_BeginRequest()
{
if (FormsAuthentication.RequireSSL && !Request.IsSecureConnection)
{
Console.WriteLine("Got here");
Response.Redirect(Request.Url.AbsoluteUri.Replace
("http://", "https://"));
}
}
All controller pages have [RequireHttps]
Using self-signed certificate.
When I use the url http://<computer name>/<app name> format from the other workstation I get the certificate warning, followed by a 404 error. If I change it to https I get the same result.
When I do the same sequence on the development workstation I get the same result.
If I change the url to http://localhost/<app name> it seems to work, but after a quick test I determined that it is going to the development build, not the published build.
Any suggestions will be very much appreciated.
Posted
Comments
ZurdoDev 7-Nov-15 13:32pm    
Make sure the website in IIS is pointing to the right files on the hard drive.

Then, from within IIS, right-click the file (you may need to click the Content View tab at the bottom) and choose Browse. Browse from IIS to first make sure the site is setup right.
mlowry 7-Nov-15 14:22pm    
Thanks. Browse on both port 80 and on port 443 goes to the right file (after security certificate error) and the page(s) seem to function properly.

Could this be a firewall issue? Both ports are set up to allow www traffic on those ports.
ZurdoDev 7-Nov-15 14:38pm    
If it works locally, which I think you just confirmed that it does, then all you need to do from the other machine is change http://localhost... to http://ipadress... and if they are on the same network it should work.
mlowry 7-Nov-15 14:41pm    
Still gets a 404 error.
ZurdoDev 7-Nov-15 14:46pm    
404 means it cannot find the page. Do you first get prompted for logging in or any other prompts?

1 solution

After 2 days of thrashing through lots of postings that sent me into the weeds, I stumbled on the right combination of things that work.
1. The folders servicing the site need to have permissions for Network Service added.
2. The website in IIS must NOT have "Require SSL" checked. If it is checked the incoming request will be rejected before it ever hits the site if not https.

After fixing this, MVC automatically redirects requests to https if the RequireHttps attribute is present.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900