Why won't VS 2010 virtual server recognize a path starting with "/"? - visual-studio-2010

When I design my web-application, I like to use "/" to designate the access to the root directory. Now, this works perfectly on my production site run on IIS 7.5.
However, when I try to run the site on VS 2010's virtual server, I keep getting 404 errors for any path that starts with "/".
Now, when I get a 404 error, the address in the addressbar is the correct address. For example, I have a link to /index.aspx' - and on the iis7.5 webserver, the path becomeshttp://my.site.com/index.aspxand it navigates perfectly. However on the VS virtual server, the path becomeshttp://localhost:61679/index.aspx` and I get a 404 error.
However, if I don't use the "/" in the path - that is, I either use a full path or leave it off, then the virtual server navigates to http://localhost:61679/index.aspx like is supposed to.
So the address is the same whether the "/" is the first character or not.
None of these links are using runat="server", so I don't need to worry about using ~.
Is there a setting somewhere to enable this?
[update]
I have a few more clues:
- When I navigate to http://localhost:61679/index.aspx it gets a 404.
- If I navigate to http://localhost:61679/mysite/index.aspx it loads fine.
- Links that start with "/" lead to http://localhost:61679/ NOT http://localhost:61679/mysite.
- This means that the "/" tells the VS server to navigate to the root of the server, not to the root of the site. However, it doesn't work this way in IIS.
If I tell VS to use IIS Express, everything works just fine.
That means there must be a setting somewhere to make "/" refer to the root of the site for Visual Studio's built-in server (I have referred to it as "virtual server").

Related

Unable to locate the model you have specified - All i did was change servers

I have a codeigniter website, using the latest version of the frame work. I was hosting my website on Azure, and it was working fine - never any issues.
I've just moved all the files to a different server, a linux one - standard normal web hosting type server with cpanel.
My site loads up, however a lot of pages I use that require models, are giving off errors, as if the files do not exist
Unable to locate the model you have specified: UsersModel
Just note : I have read so many articles today, that you need to have uppercase / lowercase and all that stuff, but that's how i already have it setup, it just does not work since changing servers. and it worked perfectly fine yesterday on the Azure server.
Also, when going to the actual file in my address bar, it takes me to the 404 error. not sure if this has anything to do with it?
Did you change your base url in config file ?
All model , controllers, helper ,library name must me capital letter.
If you change server remove index.php from config file where you will get config['index']= ""; and save this.
Still you get error then save base url like domain/project_name/index.php

Prevent apache from replacing fully qualified server name with localhost?

I have installed MAMP on High Sierra, on myserver.mycollege.edu
If I point my browser (chrome) to http://myserver.mycollege.edu/some/path, what shows up in the address bar is localhost/some/path.
And if some/path/index.html contains a link to myserver.mycollege.edu/some/other/page, that gets replaced with localhost/some/other/page
This happens for other users, when accessing my content from their own machine! This obviously fails because their browser is now trying to access a web server on their own machine instead of mine.
So my question is, what is responsible for this URL rewrite, and how do I stop it?
One thing I should have mentioned is that some/path is mediawiki-1.28.1.
The top page served out of that directory is index.php, which will do some config things as part of serving its top level page.
localhost was actually hard coded in LocalSettings.php:
The protocol and server name to use in fully-qualified URLs
$wgServer = "http://localhost";
Replacing with myserver.mycollege.edu fixed the problem.

Allow Microsoft symbol server through firewall

We have a new setup where we don't have internet access for our machines which we code on. (Stupid Idea in my opinion). Our Network Security department wants to know if the following URL is the only URL needed to allow firewall access to Microsoft's Symbol server.
msdl.microsoft.com/download/symbols
Is this the same URL that visual studio uses when it goes off and tries to download the needed .pdb files when debugging?
If you navigate to that url you will see you get an HTTP 302 response, which redirect you to another URL depending on what symbol you request for. I hope your firewall supports pattern matching for URLs.
Here is a non exhaustive list i got from my windows server 2016 c++ project
vsblobprodscussu5shard1.blob.core.windows.net
vsblobprodscussu5shard3.blob.core.windows.net
vsblobprodscussu5shard10.blob.core.windows.net
vsblobprodscussu5shard11.blob.core.windows.net
vsblobprodscussu5shard13.blob.core.windows.net
vsblobprodscussu5shard14.blob.core.windows.net
vsblobprodscussu5shard18.blob.core.windows.net
vsblobprodscussu5shard19.blob.core.windows.net
vsblobprodscussu5shard20.blob.core.windows.net
vsblobprodscussu5shard21.blob.core.windows.net
vsblobprodscussu5shard24.blob.core.windows.net
vsblobprodscussu5shard32.blob.core.windows.net
vsblobprodscussu5shard37.blob.core.windows.net
vsblobprodscussu5shard38.blob.core.windows.net
vsblobprodscussu5shard56.blob.core.windows.net
vsblobprodscussu5shard65.blob.core.windows.net
vsblobprodscussu5shard80.blob.core.windows.net
vsblobprodscussu5shard81.blob.core.windows.net

How do I specify an IIS website to create a deployment package via visual studio

I am attempting to create a deployment package for my website via Visual Studio 2010. The website in question has a binding that I point to 127.0.0.1 in my hosts file. My web application project settings point to that website and all works fine. When I try to create a package, however, the settings from the wrong site are used. How can I tell the deployment package to use the correct settings and what mechanism controls this?
Update:
It appears that the MapUriToIisWebServer task in Microsoft.Web.Publishing.targets is coming up with the wrong IIS website. Got that from the output of using msbuild via the command line:
Package:
Invoking Web Deploy to generate the package with the following settings:
$(LocalIisVersion) is 7
$(DestinationIisVersion) is 7
$(UseIis) is True
$(IisUrl) is http://mysite <-- correct url (use hosts file to point localhost)
$(IncludeIisSettings) is true
$(_DeploymentUseIis) is True
$(DestinationUseIis) is True
$(IisUrl_SiteID) is 2 <-- not the correct id
$(IisUrl_SiteFriendlyName) is notmysite.com <-- not the correct url
$(IisUrl_SiteRelativePath) is /
The MapUriToIisWebServer task appears to ultimately call upon Microsoft.Web.Publishing.Tasks.Iis7WebServer
to get the correct site info for the supplied url. The Initialize(UriWrapper uri, bool useLocalHost) call seems to do the work, and is going wrong somehow.
I found that this "site resolution" issue is influenced by the IIS site settings - particularly hostname and the "ip addresses". For example if I go to the site that is being incorrectly identified and change either the hostname to anything else OR change the "ip address" setting from "all unassigned" to a defined ip address, then the site resolution changes to another (also misidentified) site in IIS. Repeating this process again then resulted in the correct site being identified by the "build deployment package" process.
In short, there seems to be a bug in Microsoft.Web.Publishing.Tasks.Iis7WebServer

IIS 7.5 under Win7 Prof. 64bit Returning Blank Page (No HTML at all)

I am trying to setup my development environment in Windows7 and am having trouble getting IIS to work. I have set everything up like I have been doing since IIS6 so I have the basics down. My problem must be in something that has changed between IIS7 and IIS7.5 or in the OS.
None of my websites will return html. Not the default site and not a newly added site.
If I
telnet localhost 80
Then at the blank screen
GET / <enter>
I get nothing, not a single header or HTML element.
If I enter garbage instead of a GET request I get the following HTML:
HTTP/1.1 400 Bad Request Content-Type:
text/html; charset=us-ascii Server:
Microsoft-HTTPAPI/2.0 Date: Thu, 17
Sep 2009 17:04:01 GMT Connection:
close Content-Length: 326
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML><HEAD><TITLE>Bad
Request</TITLE> <META
HTTP-EQUIV="Content-Type"
Content="text/html;
charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid
Verb</h2> <hr><p>HTTP Error 400. The
request verb is invalid.</p>
</BODY></HTML>
So that proves IIS is there and handling requests on port 80.
In my IIS Logs path, I have no files at all. So for whatever reason logs aren't being written.
If I view the Basic Settings on the Web Site in IIS Manager then click the Test Connection button I get an error related to permissions:
The server is configured to use
pass-through authentication with a
built-in account to access the
specified physical path. However, IIS
Manager cannot verify whether the
built-in account has access. Make sure
that the application pool identity has
Read access to the physical path. If
this server is joined to a domain, and
the application pool identity is
NetworkService or LocalSystem, verify
that \$ has
Read access to the physical path. Then
test these settings again.
My AppPool is running as ApplicationPoolIdentity which doesn't seem to be a real user, so I can't give ApplicationPoolIdentity file permissions. I did as a test give IIS_IUSR and everybody else I could find full access to the path.
No matter what I have done up to this point, I have not seen IIS say the permissions are correct. However, I have also never seen an error, especially not a permissions error (300s).
So, any ideas? I have tried to completely remove IIS, c:\inetpub and then reinstall everything. I am basically doing the default setup here, so it must be something simple.
Thanks for your time...
I solved it. For anybody else having the issue, here is what I did.
First to replicate the issue: I was installing IIS by choose "ASP.NET" in the Add/Remove Windows features menus. This was selecting everything needed for IIS to run .NET apps, but interestingly it couldn't serve static pages (.html, css, js etc.) My test page was just a hello world .html page, so that is why it wasn't being served.
To fix it: To enable serving of Static content you must specifically choose "Static Content" under Common HTTP Features in the same Add/Remove Windows Features list. Once you do this my test page worked fine.
In summary: I don't understand how a typical .NET would run without static content (CSS, Images, Javascript), so I don't know why MS wouldn't include Static Content by default when choosing ASP.NET. Perhaps my workflow in installing IIS was wrong.
I'm sure there was a way to trace the flow of the request to find static content requests were getting blocked, but I don't know how to do that.
Matt Cofer's resolution is correct: in order to view static content you must have installed the Static Content feature during your initial installation. However, I found that Add/Remove features did not work for me: it only showed a subset of features and nothing to do with IIS.
So... here's another way to install Static Content:
Open Server Manager
Start Menu > type "server manager" in search field > click resulting link
Expand the Roles node
Right-click Web Server (IIS) node to view context menu
Select Add Role Services from the context menu
When the Add Role Services window opens, navigate to Web Server > Common HTTP Features
Enable Static Content
Click Next

Resources