I have a number of C# web applications that I have deployed to our in house web server so they can be available only to our internal users.
The webserver is running IIS 8.5 and I have set up a couple of sites in this that point at the applications, this is working fine except that the url you have to use to navigate to the applications is in the following format serverName:portNumber.
I would like to change this so the urls are more user friendly and they dont have to remember the server name and the port number.
I am an IIS noob so I don't know what to look into/try so any explanation using words of one syllable would be greatly appreciated!
I have seen that this might involve something to do with bindings (?) so I have included my current binding settings for my sites below.
Site1
Name: MySite1
Type: http
Host name: null
Port: 80
IP Address: *
Binding Information: null
Desired URL: www.mysite1.com or something equivalent
Site2
Name: MySite2
Type: http
Host name: null
Port: 81
IP Address: *
Binding Information: null
Desired URL: www.mysite2.com or something equivalent
Thanks in advance
In IIS you can right click on each website and go to Edit Bindings and you will be able to configure IP addresses and ports in there. If you leave the IP address as * (or "All Unassigned" as IIS calls it) and you want to have multiple sites with the same port number (80), then you need to specify the host name for each site. www.mysite1.com for the first site and www.mysite2.com for the second site as in your example. Of course you'll have to make sure those host names are in DNS so that your users will be able to connect to the server when they type in the URL.
Try changing bindings from C:\Windows\System32\drivers\etc
There will be a line '127.0.0.1 localhost' which you can uncomment and add your ip's here.
eg : ip : port staging.yoursite.com
Related
When i log HttpActionContext.Request.RequestUri.AbsoluteUri, it returns:
http://productionurl.com:8083/api/stocks/1/images/
I have no clue how this port number :8083 is getting appended.
Issue it causes is that i am hashing document with url as http://productionurl.com/api/stocks/1/images/ [Same url without port number] and hence hash match fails on production.
How can i find how this port number gets appended and how can i avoid this?
It is related to how you configured your website on production. It looks like that your website is configured using port 8083 on production. Default HTTP port is 80 which means if no port is specified then it is 80.
URL - http://productionurl.com/api/stocks/1/images/ is same as http://productionurl.com:80/api/stocks/1/images/
Just double check in IIS website settings. The port should be 80 if you don't want it to append in URL.
It might be because in your local your website must be running on 8080(which is default) and on your production its running on a different port which is not default.
In my WCF service, I need to publish it in the Bonjour service. The reason for this is to make the customers that consume my service know which computer it is running.
This works well.
But when I have machines with special characters in HostName, customers of this service can not eat because an error occurs in time to resolve the url.
Example: "http://máchine:8888/service.svc"
One solution would be to use thought to solve here the IP of the machine in place of the hostname. But when the computer works only with IPv6, I can not publish the service because the following error occurs: "Inalid URI: Invalid port specified."
How can I solve this problem without changing the HostName?
In my experience, when mapping zeroconf services to URLs, it's best to not rely on the service's host name. Resolve the service to an IP address (for example, with avahi, using avahi_service_resolver_new) and use the IP address in the URL. This avoids all sorts of problems with fancy hostnames and system resolvers that can't resolve zeroconf names (often the case on embedded systems).
If you got an error like "Inalid URI: Invalid port specified.", it sounds like you might simply have neglected to enclose the IP address in [square brackets]. The pseudocode for forming your URL should be:
if IP address contains ":"
url = "http://[" + ip address + "]:port/whatever"
else
url = "http://" + ip address + ":port/whatever"
There are two additional complications:
If you are using HTTPS, certificate matching will probably fail because the common name on the certificate won't match. It's not clear what to do about this in general because the very nature of an autodiscovered service usually means you can't meaningfully authenticate the server anyway. So you might be able to get away with just turning off certificate verification in your HTTP client.
You might not be able to use IPv6 link local address because there is a deficiency in the standard (RFC) for URL syntax that means it is not possible to attach a % character and an interface name to the address in the URL. Some HTTP clients allow the obvious extension to the standard to support scoped addresses, but others don't (for example, all of the major web browsers don't!).
I have a partial view which is displayed on a non-HTTPS page, but POSTS to a controller that requires SSL. The form definition is this:
<form id="authForm"
method="post"
action="#Url.Action("authenticate", "auth", new {}, "https")">
The problem I'm having is that, within Visual Studio and when debugging, the host and port are localhost:64043. However, the Url.Action call above doesn't put the port number in, meaning the browser directs to my IIS installation. Do I have to add something else, or override this method? I want my application to be location agnostic.
Thanks in advance!
You could include it like this:
#Url.Action(
"authenticate",
"auth",
null,
"https",
Request.Url.Host + ":" + Request.Url.Port
)
Of course this means that your local web server must support SSL which is not the case with Cassini. You could use IIS Express for this to work.
The integrated development server does not support HTTPS, but you can use your local IIS - see HERE.
Http and https connections are usually on two different ports so if you change from one protocol to the other you either need to use the standard port or supply a specific port yourself. There's no sensible way a generic system can determine the right port
Use Request.Host.ToUriComponent():
string actionUrl = Url.Action("Action", "Controller", new { blah = "" }, Request.Scheme, Request.Host.ToUriComponent());
This also correctly omits the port number when it is the default port for the scheme, i.e if the Scheme is HTTP and the port is 80, or the Scheme is HTTPS and the port is 443, it will be omitted.
My server name : server, my server ip is 192.168.10.200
SPSite site = new SPSite("192.168.10.200:7000") throws the following exception:
The Web application at
http://192.168.10.200:7000 could not
be found. Verify that you have typed
the URL correctly. If the URL should
be serving existing content, the
system administrator may need to add a
new request URL mapping to the
intended application
.
while
SPSite site = new SPSite("server:7000") works perfectly.
any ideas?
OS: Windows 7 64 bits + Sharepoint 2010
Your server is set up for serving more than one website and uses a Host header in the http request to sort out which one a request is for.
If you give it the IP address, it doesn't know which web server is meant.
The site could be configured with a host header for server and thus only answering on that and not on IP.
One clue is that your code says the port number is 7000 but the error message says it is 8000. Is that a typo in your actual code, or did you make a mistake in transcribing the code or message into your Question?
Also, the IP addresses don't match.
I'm trying to consume a webmethod but it seems that my application can't resolve DNS. The problem surfaces when I configure my application with an url (e.g.: http://mywebservice.com/webservice/methods.asmx), but it does not when I access the same webmethod through the server's IP address.
The thing is that I need to access the webservice using the url and not the IP address due to an existing DHCP server policy.
Can anyone help me ?
Thanks in advance.
UPDATE: Checking out what moocha asked me to do, I found out that:
D:>nslookup server.com
Server: dnsserver.mycompany.com
Address: XXX.YYY.XXX.YYY
*** dnsserver.mycompany.com can't find server.com: Non-existent domain
Have you tried confirming the same DNS query works via nslookup from the same system on which your application runs?
I.e.,
C:\>nslookup
Default Server: whatever.dns.example.org
Address: 111.222.333.111
> set q=a
> mywebservice.com
Server: whatever.dns.example.org
Address: 111.222.333.111
Non-authoritative answer:
Name: mywebservice.com
Address: 208.254.26.139
Digging a little bit more I found that there is a proxy in between my PC and the server. Therefore, I'm oblied to log with a valid user in order to access the internet. The problem was that my application's server (where the IIS is running) was configured to run using anonymous access. All I had to do was to configure in the IIS an user that has permission to access the internet (through the proxy). Finally the problem is solved.
There was another option, I could use the logged user's credentials to grant access through the proxy; but that required that all users use the same log in information for the application and the intranet.