IIS7 public hosting & domain question - c#

I am trying to test my asp.net project website for public access, so far I have done:
Uploaded to IIS 7 and binded to my localhost (192.168.....) Ok works well.
Obtained a free domain from 000webhost.com/
I tried to change the binding in IIS to the free domain mytestsite#herobo.com but apparently it's showing the webhost default page instead.
Is is possible to remain hosting all web project files in my IIS but use the free domain name so that the public can access?

I believe you need to change this on the hosting site. They should have a webpage you can use to edit your DNS records. This might be it (View Account Details)

192.168 is a private ip address. No one on the internet will be able to see you. Your ISP likely provides you with a public IP address that can support certain server tasks but many ISP's block port 80 so that home users can't start hosting web servers. That means you may need to host your site on a non-standard port.
So, in order for other people to browse to your domain and have that domain's services be handled by your local machine, you'll need to have your domain's A record (in the DNS settings for the domain) pointing to your public IP address. If your ISP assigns you a dynamic IP address, this will require updating your domain name's A record each time you are assigned a new public IP address. This can cause a period of "unavailability" as the changes to the DNS records take time to propagate.
There are services such as DynDNS that can make this rather automatic.
Then there is the issue of configuring your router (assuming it's a NAT based router), which is likely going to need to be configured to forward requests for web services (for port 80 or whatever port you end up using if you need to work around your ISP's restrictions) so that requests from the internet are forwarded to your machine. Your router likely has "port forwarding" and "dynamic dns" features built in, but it'll be manufacturer specific.

Related

How do I get the external IP address of a client if the server and the client are on the same domain?

The long and the short of this is that we use a 3rd party to retrieve addresses from the PAF database (and similar for non-UK addresses). They need the client IP address to deduce what sort of addresses (ie: British/Irish/Canadian/Amoeboid-Zingat'ularian) to default the search to.
We pass this traffic through a relay written as an MVC controller [HttpPost] action, and inject the authentication on the server, for security reasons.
For our customers that have our software hosted on Azure, this is easy, as the traffic between MVC controller action and the 3rd party's javascript will pass through an internet-facing firewall, and the IP gained using Request.ServerVariables["REMOTE_USER"] will be good enough.
BUT what if they have our software installed on premise? Then, isnt it possible that the IP this method gives me is one that only means anything to the local network?
If I could detect the difference, I could decide whether or not to send the IP: and therefore get the 3rd party to decide.
If the case is them installing your software on their servers would it not be easier to record what the location is at installation time or on application start.
No need then to read on each and every call. http://bot.whatismyipaddress.com/ called once and stored in app memory would suffice.
I am also assuming that the clients of this installed software will be in the same location. Almost certainly if they have local ip addresses.

How to dynamically detect server's IP address (without custom DNS server)

I have a client application that I install in my customer's offices. It's a hybird application, which means that some of our customers require us to install it inside their own network, without internet access. There are also some customers, that use our cloud solution (we also have version of an application in cloud - Azure). Our server is ASP.NET application and client applications vary by platform - we have web apps, Windows desktop apps, as well as Android apps.
So the problem is, that because of this heterogenous nature of the application, we need to rebuild our applications for each customer with different IP address of a server we have in their network. Apart from that we would also like to be able to use the same app for our "cloud" server, which can be reached also by static IP address or DNS name.
What my constraints are:
Usually I don't have access to the internet from inside those networks
IP Address of the server depends on customers' network, it varies among customers
I cannot create one application with one IP or DNS address of my server, because server IP depends on my customers
I don't have DNS server, my customerss are very small companies that usually also don't have DNS server, only home-grade routers, nor do I want to setup my private DNS servers inside those networks, because I don't have access to customers' routers.
Usually I don't have access to customers' routers
How we do this today:
We rebuild the application and change IP for each customer every time we need to do install/update
How can I avoid those problems? What are the usual ways the industry solves this?
Thank you in advance for help.

Creating Virtual Directory returns error

I wrote a web service and hosted it on Local IIS. I clicked Create Virtual Directory: Project URL (my local IP address is 192.168.1.102). I get an error:
Unable to create the virtual direcotry. Could not find the server 'http://192.168.1.102/ on the local mashine. Creating a virtual direcotry is only supported on the local IIS server.
What do I need to do to solve this?
Unfortunately your request is quite a large request- You have a few issues you need to overcome in order to successfully accomplish your task.
The Problems:
Permissions
Ensure Site is configured correctly within IIS.
Ensure you've configured a valid Application Pool within IIS.
You see these are going to be your largest hurdles; mostly because in order for your site to function correctly it will have to allow the Network Service account to perform functionality-
Hopefully this starts to gauge your complexity a bit-
Without code it will be difficult to see why this error has occurred. However, based on your listed IP Address that isn't your actual address. You see your machine is connected to a Router which knows which machine made the given request-
Which means your real IP could be: 50.5.1.14 but the Router has assigned you an IP of 192.168.1.102. So you'd want to target your Wide Area Network and ensure that your local machine will accept the request when it goes through your port.
If your actually testing this on a local machine, the most simplistic thing you could do would be to use the localhost address- This will utilize the Network Interface Cards built in loopback address 127.0.0.1. Which may alleviate your issue within your test environment.
Without more detail it will be quite difficult to correctly answer you.

How do I make my ASP.Net website viewable in my private home network using IIS 6.0?

I want to know how I can make website available in my private home network? I know I am supposed to make my IP address static but I still do not know the complete steps to accomplish what I want to do. Is this even possible? If it is can someone please explain to me what I have to do?
A lot of ISP's won't allow you to receive requests on port 80. However, you can test this by trying...
-Install IIS - when you go to http://localhost, you should see an IIS start page.
-If you have a router/switch, you'll need to access the admin interface on it. This is usually default 192.168.1.1, but varies by manufacturer. You'll also need to get the local IP address of your IIS server. Go to run, hit CMD, and type IPCONFIG.
-Inside the admin interface, you'll have port forwarding. Forward port 80 to the IP address of your IIS server. Save.
-Now, get your actual IP address by going to a site like whatsmyip.com.
That should do it. Ask a friend or a family member to browse to your IP address. If they see your site, your ISP allows you to host. If they don't see it, your ISP has it blocked..
Having said that, you should check out serverfault.com - this question is more suited for that site.
This is pretty easy but you need to read up on some security before making anything live.
Static IP addresses cost more money than dynamic ones so I suggest signing up to http://www.no-ip.com/. It's requires installing a program which updates a domain which your ip address everytime it changes.
You will also need to use port forwarding on your router so it knows to send all http requests to your PC. HTTP data to passed normally through port 80 or 8080.
Hope this helps.
Check this out: http://msdn.microsoft.com/en-US/library/1y1404zt(v=VS.90).aspx

How can I programatically limit access to a Webservice?

I am writing a traditional ASMX webservice using C# with .Net 2.0 for deployment on IIS.
The webservice will be deployed in a shared hosting environment where each client has their own copy of the application sitting in a separate virtual directory (I know, I know - it's a legacy app). There will be an individual copy of the Webservice sitting in each virtual directory.
As the Webservice could potentially do some powerful things, I would like to optionally limit access to it to certain IP addresses. Doing this in the firewall isn't a very good option as it is only the webservice that should be limited and not the rest of the website - and it is on a per-virtual-directory level.
Can I programmatically read the IP address of the requestor and compare it to a list so I can reject calls from other addressess? Are there any major pitfalls to this?
Thanks
Yes you can do it easily.
[WebMethod]
public bool IsAlive()
{
string callingAddress = HttpContext.Current.Request.UserHostAddress;
return (callingAddress == allowedAddress);
}
The only pitfalls are the maintenance of the list of IP addresses.
It's also worth noting that you can configure IP address access control on a per web application basis from within IIS. I have used both approaches at different times and it really just comes down to how you want to maintain the list of authorised IP addresses.
only pitfalls are the maintenance of the list of IP addresses.
It's also worth noting that you can configure IP address access control on a per web application basis from within IIS. I have used both approaches at different times and it really just comes down to how you want to maintain the list of authorised IP addresses.

Categories