Simulate domains locally in ASP.NET /IIS7 - asp.net

I would like to simulate that my ASP.NET application is hist by say simdomain.com.
How can i do that easily?
Ideally I would like some kind of filter, so requests to certain domains are routed to localhost, and it should be easy to turn it on and off.

Edit the hosts file.
Run notepad c:\windows\system32\drivers\etc\hosts
Add the following line:
127.0.0.1 simdomain.com
Open IIS admin and add a "simdomain.com" website. So it knows the domain.

Try editing you local hosts file. The default location is %SystemRoot%\system32\drivers\etc\hosts in most Windows systems.
Then you simply add the line
127.0.0.1 simdomain.com
That should do it.
EDIT: Ah, and as Chakrit said: Open IIS admin and add a "simdomain.com" website. So it knows the domain.
This depends a bit on IIS version, but if I remember correctrly for IIS7 do as follows:
Run 'inetmgr', or access the IIS setings via the Control Panel.
In the menu on the left open 'Sites', and right-click on the site you want to access. Choose 'Edit bindings..'
Click add. Type: Http, IP Address: All Unassigned, Port: 80, Host name: simdomain.com then click OK.
Might as well make my answer correct, even if the post is a tad redundant. ;)

Maybe have a read of this SO discussion; "ASP.NET Development server or localhost IIS"

Related

Multiple websites under a folder in IIS

I have a problem with websites in IIS.
The first thing that I did was that I set basic .html website in IIS under Default website (port 80). I moved the code in C:\inetpub\wwwroot\Test and it works.
When I type in the browser localhost/Test, it works but I have an ASP.NET Core web app and I want to open it using localhost/MyAspNetSite in the browser. Is this possible???
I'm asking that because when I right click on the Default website I have no possibility to add new website, only virtual directory or application. In my case, I put my .net code in C:\inetpub\wwwroot\New and in I added the new website on port 5000 and it works like localhost:5000 but not like localhost/New. I hope that you understand me.
Is it possible to have two websites on the same port or to connect two websites or something like that?
I am sending image about this problem. Thank you
You can host multiple sites under the same IP Address. In this case, the IP Address is called "Shared IP Address". This concept is used by all the shared host providers in this world.
That you basically need to do is to go to your IIS -> click your domain -> Bindings -> and add "www.yourDomain.com" and "YourDomain.com" to the IP. If you have a second site, you just have to do exactly the same thing, you can check this blog post it can help u to understand all that things
http://woshub.com/run-multiple-websites-on-the-same-port-and-ip-address-on-iis/

IIS Returns a /IISConfig/Config.aspx (Blank) Page

I'm trying to install Sense/NET on my Computer for demo purposes. I managed to install the Demo (Community Edition) Version on Port 80 as i followed the instructions on their WIKI Page
but when i tried to install another copy of Sense/NET (regardless of being a Demo/Community/Evaluation Edition) i kept getting this Blank /IISConfig/Config.aspx Page.
I am running on Windows 8.1 and IIS 8.x
if i am mistaken in any configurations please let me know and help me.
For SenseNet to work properly you have to register the url in two places:
in IIS Manager, on the IIS site you created
In SenseNet Content Explorer (the admin GUI), on the site content's Edit page.
So it is absolutely OK to have any number of urls with different port numbers, the localhost:80 above is just an example in the wiki.
How to change url and authentication settings
As Miklós've written Port 80 is only an example, there is no limitations on port numbers. You can configure any other port you like as long the IIS setting is corresponds the SenseNet site content's "URL list" configurations.
I assume default install goes with port 80, so if you've installed an other copy of SenseNet you should edit manually the second portal's ports in the IIS and in SN too. You can either edit the latter through the Edit page "URL List" field of the site content (eg. /Root/Sites/Default_Site) in SenseNet Content Explorer or set it in the web configuration file's "urllist" section.
Try to user your port using like this:
localhost:80 or any port you configured
Hope it help
EDIT: According to their WIKI (again)
First of all, check the port number: it should be set to '80'.
it is just strange as it seem that it must be under Port 80 and Port 80 only. is there any walk-through such limitations ?. like for example, another web app is also running along Port 80 and Port 80 alone ?. can this be achievable via web.config or iis ?
if not, there technically there is nothing we can do. The least is to mark my own post as the answer.

deploy asp.net project on another computer

Just to begin I am a beginner in ASP, and havign some difficulty in deploying my first application.
I made a asp.net project in VS2008, and I ws trying to deploy it on another machine and following are the steps that I did:
right clicked on website and published set loaction to c:\inetpub\wwwroot and pasted my app to this folder.
Then I went to control Panel- admin tool- IIS and there it showed the website which I copied then went to its properties added documents, set ASP>NET version, it was blank by default. Then edited the configuration and under authentication changed its mode to none.
And then when I cick on the app in IIS and browse it showed the desired output, but I need to know how to open the same app in browser.
Thanks
If I've understood this correctly - it does depend on how the website has been set up in IIS. At it's most simple it would be
As the default website
http://[external IP of webserver]/default.aspx
As a virtual under the website
http://[external IP of webserver]/[virtualName]/default.aspx
Assuming there is a file called default.aspx (insert your own)
if default.aspx is specified as a default document for the site
http://[external IP of webserver]
http://[external IP of webserver]/[virtualName]
if you are using binding to a specific IP and or port (look in IIS, left handside at the binding link - see image below)
http://hostname: optionalpost
Apologies if I have misunderstood
EDIT
To check whether the site is active at all and to get a better idea of what the external URL is then on the left hand side of IIS will be browse to website. Click this to check whether the site comes up at all.
If it does then the URL should be obvious. It could be one with a host header i.e. looks like a normal URL i.e.
http://mytestsite.com
If it is in this format then you may not be able to browse externally if you can't resolve this hostheader to the IP of the box. To get around this then edit you host file and add a mapping from the url to the external IP of the box.
Host header is at following in windows 7 (or windows generally i think)
C:\Windows\System32\drivers\etc\hosts
Please back this file up before editing it

IIS7 and Classic ASP and Applications and Paths

I yesterday received a zip file containing an old asp site from 2005. Its came in a folder called ivx.
I've unzipped ivx to c:\inetpub\wwwroot and then created an application in IIS called ivxapp and pointed it to c:\inetpub\wwwroot\ivx. Now when I type http://localhost/ivxapp, I am able to access the index page.
My problem is, whoever designed that site, designed it when IIS5 or IIS6 was around. He's used paths like more... which leads to http://localhost/new_posts.asp and not http://localhost/imagevertex/new_posts.asp
The whole site is some 21000 lines of code and contains many many references like this. Then comes the problem with <!--#include virtual = "/common/adminverify.asp" -->
Instead of having to manually edit the entire code, do you know a way to get things going?
This site worked perfectly well on a production server. Right now it's on my local machine on Windows 7 64 home premium.
Yes, you need to give this site a root-URL of its own, and not run it in a subdirectory of your localhost.
This is more of a web-administration question, but what you need to do is either run it under "localhost" directly, or add a domain-name to your network to run this site under.
The easiest for you right now is probably the first option.
If you aren't running a different site under localhost already:
Go to the IIS manager and click the 'localhost' site. On the right side of the IIS interface you can change the basic settings. Point the physical path to the ivx directory. You can reach the site directly on http://localhost.
If you are already running a site under localhost you need to keep:
Now, if you -are- already running a site on your localhost, the second easiest option is to run the ivx site under localhost, but on a different port. To accomplish that, click on the current ivx site in IIS, change the path in the same way as descibed above, and after that click on "bindings" in IIS, and change the PORT for the ivx site to something other than 80, for example 81.
The ivx site will then run on http://localhost:81, your current localhost will still run on http://localhost.
The hard way: adding a host to your network or PC:
The last option is to add a new hostname for the site to your network. You can add an A-record in your DNS for the ip-address of your server or add a host name to your HOSTS file in Windows on your server ("server" in the sense of the machine that runs the site, which can also be your local machine)
You can add a made-up name to the ip-address of the server, and in IIS' bindings add that name under "host name". this way you can run two different sites on the same machine, the "host name" seeting in IIS will make sure that calls to that specific hostname will reach the correct site. Adding it to the DNS of your network, or the HOST file in Windows will make sure the name is resolved to the correct machine (your webserver).
This last option is a little tricky of you've never done something like this before, but the first option works just as well.
Good luck!
Erik

How to make an ASP application available over an Intranet

I've created a copy of our legacy, (decrepit) homegrown Timesheet ASP application on to a different, newer workstation for backup purposes.
I've finally got it to the point where I can run it locally over http, using this address:
http://localhost/timesheet/Timesheet.asp
I would like to test it over the network with an address like this:
http://backupServerHostname/timesheet/Timesheet.asp
The live application uses a similar addressing scheme. I'm just not clear on what needs to be done to make this application available from the new server.
You'll want to ensure that backup server isn't using windows firewall or something to block port 80 access. Also you may run into permissions issues if your asp app isn't set to allow anonymous access (assuming you want that).
Goto the folder where the Timesheet web stuff lives (could be C:\Inetpub\wwwroot\TimeSheet, just a guess).
Then Right-Click on the folder, select "Properties", then click the "Web Sharing" tab, then select "Share This Folder" option, this should bring up an "Edit Alias" window. Change the alias to "backupServerHostName".
This is assuming all the machines on on the same LAN.
Nothing needs to be done. If it is serving localhost on Port 80, it should serve other computers on your local network using a name similar to the one you gave. It may literally be as easy as just trying it...
If you just need to browse to it from other machines at work, just replace the "localhost" part with your machine name.
If you need it accessible over the net, you need to install it with IIS on an outward-facing server, and then browse to it that way.

Resources