publish asp.net application localy in iis - asp.net

i'm trying to publish asp.net app localy on my computer:
In the iis i right-click the "sites" and selected "Add website"
In site name i wrote: www.mysite.com
Physical path: i created new folder named "www" on my c driver
Type: http
IP address: all unassigned
port:80
host name: www.mysite.com
in visual studio:
I selected build-> publish
get the message that both the built and the publish succeeded.
In "select publish target" i pressed "custom" and created new profile
publish method: file system
target location: c:\www
and still when i write the url in chrome or explorer i get url not found (the computer is not connected to the internet)
what am i doing wrong?

In IIS Manager --> Application Pools
check if your added website application pool status has been started or not?
Also check whether your .NET Framework version is 4.0 or not for added website in application pool? If not double click and change the options.

IF you're not using http://localhost, then DNS is missing.
You need to map whatever "web site name" (www.mysite.com) you used to:
your local loopback ip, 127.0.0.1, or;
whatever local IP your router/dhcp service provided your local machine), or;
if you want to be fancy and assign multiple IPs to your machine, then assign one to the site
Finally, map any of the above to your hosts file.
Hth..

Related

How to run a web application from the command line in Windows 10?

I've built a web application (i.e., it's got .aspx pages and .dlls, but no .exe) in VS2017. I need to be able to invoke this application on my local machine from the command line. Does anyone know how to do this?
I tried
explorer http://localhost:59135/OAuth2Manager.aspx
But I get an error page saying "This site can't be reached". (If I run the solution from Visual Studio, it comes up with no problem.)
Create site in IIS. Right click it then edit bindings. Use this settings for local use:
type: "http"
Host Name: "YourName.local"
Port: 80
IP Address: *
Also you will need to modify your hosts file to point to your site to the correct address.
Go to
Windows/system32/drivers/etc/hosts
and add: "YourIP" "YourName.local" or use local host IP for example:
127.0.0.1 mysite.local

IIS intranet link directly to hard disc folder

I'm trying to use IIS 7 to run an HTML5 app via localhost directly out of the folder of the GIT repository where I am developing files (e.g. I go to [ip address]/myApp and it runs C:/git/myApp/index.html).
So I set up a new web site in IIS that has the following advanced settings:
Application Pool: myApp
Bindings: http:*:80:newAutoDemo
ID: 2
Name: myApp
Physical Path: C:/git/myApp
Physical Path Credentials Login type: Interactive
Start Automatically: true
However, when I try to go to [ip address]/myApp, it looks for files in C:/inetpub/wwwroot/myApp instead of my GIT directory (throwing a 404 error). Any idea how to fix it so that it links directly?
Note: I would like this to run on other computers on the same LAN as well as the computer with IIS running.
A new WebSite in IIS means that it's no longer under the default http://localhost/ site. Looks like you've got it set up to respond to http://newAutoDemo, so you'd need to make sure your DNS points that domain name to this IP address (if you're testing from a single machine, you can do it in the hosts file).
If you want to access it as http://{ipaddress}/myApp, then rather than creating a brand new website in IIS, you'll just want a new virtual directory or application underneath Default Web Site.

Use Local IIS Web server for debugging

So I'm trying to setup a local test domain so I can have a subdomain using this article. My problem is that I can set up the sites fine in IIS and browse to files there. But when trying to setup visual studio to use the site for eg. In Project Url: http://localtest.me when I click Create VirtualDriectory I get the following error: Unable to create virtual directory. The URL 'http://localtest.me' is already mapped to a different folder 'C:\Websites\site'.
If I delete the site from IIS and allow visual studio to try create it, I get the following error: Unable to create the virtual directory. Could not find the server 'http://localtest.me' on the local machine. Creating a virtual directory is only supported on the local IIS server. But the site localtest.me poits to 127.0.0.1, which is my local machine right?
So how do I set up debugging in a scenario like this where I already created the site in IIS?
Instead of using the "Use Local IIS Web Server" setting in visual studio I always check "Use Custom Web Server" and point it at my local url. for your example localtest.me with the start url above set to localtest.me
If you still run into problems you can always get into debug mode but doing attach to process instead of F5 and selecting the IIS process.

Set up ASP.NET web app on server and run on other computer in the network

I googled this a bit, but could't find anything useful.
I need to set up my ASP.NET web app on my server, but run it from another computer in the network.
How can I do this?
The idea is to have the files on the server and run the app by typing the ip adress of the server in the browser adress bar to run it.
eg. 158.1.6.102/myApp.aspx
Any help is appriciated!
Thanks!
Andrej
Steps:
a. Set up the site in IIS on your server. Make a note of the Host Name under the basic binding properties e.g. MyApp.local
b. Set this in your hosts file (%WINDIR%/system32/drivers/etc/hosts) on your workstation machine.
...
MyApp.local 192.168.1.100 <use the IP Address of your Server />
...
c. In the Properties sheet for your Web Application in Visual Studio (right-click the web project in Solution Explorer and get 'Properties') go to the 'Web' section and put a dot in the radiobutton that says 'Use Custom Web Server' and set the 'Server Url' field to http://MyApp.local (or whatever you put for step 1).
d. Build and Go/Debug!
hth
you need to publish it on webserver (IIS) and then you can access it from another machine.
(assume that ip address of webserver is 192.168.0.1)
http://192.168.0.1/webapplication
the most important is the windows firewall of webserver should allow access to another machine.

Friendly URLs for localhost ASP.NET websites

I Use Visual Studio 2010 with ASP.NET 4.0 and IIS7.
When I open my site, the URL looks like this
http://localhost:6549/Website/help/tab/contact-us
I want a friendly URL:
http://mysite/help/tab/contact-us
or anything that will help me to get rid of the Port 6549 from URL
http://localhost/Website/help/tab/contact-us
I use ASP.NET Development Server which is what Visual Studio use when you run a localhost website
Wait !! Please make distinction between "Properties window" and "Property pages" of the project. I always tried your advices, but using "Property pages", and there is no such property like Use dynamic ports on that page. This property can be found only in the "Properties window"
Assuming it's the ASP.NET development server:
To get rid of the port number you need to do this
- go to properties of the project
- click the web tab
- check the specific port and assign 80
There is also a virtual path setting here which you could set to /
Is your solution configured to use IIS and not the ASP.NET Development Server? There is also a property on the web application where you can specify the port (or allow for a random port to be chosen) - port 80 is the appropriate port - this requires administrator access to the process that is launching the web site.
Edit:
I was thinking you can use your host file to redirect the user, but I checked and you can't redirect to a port.
If you have IIS7 on the machine, just make the location of your web development folder into a virtual directory on IIS.
Then you can access it by http://localhost/website/

Resources