WebServices and Web Application in the same IIS - asp.net

This is a very silly question, but I am begginer on this subject so:
If an Application A (asp.net MVC C application) is hosted in the same machine and IIS of WebServices B, is it possible that A consume B by using IP instead of URL?
If yes, Is this behavior configurable?

It is possible and very simple. Just go ahead and use the IP when specifying the address on your Application A. You can even use 127.0.0.1 and it should work.
However, if both your applications (asp.net mvc and webservices) are bound to port 80 and differ only on the host, you will need to create an entry in the local HOSTS file pointing to the local IP in order to make it work.

It is certainly possible. If your service is SOAP based (basicHttpBining, wsHttpBinding etc.) you could consider using netNamedPipe binding instead.
This is optimised for inter-process communication on the same machine.
It doesn't impact your service code, so if you split onto two servers in the future, it will just be a config change.

Related

Is it possible to host both web/SignalR and WCF w/ netTcpBinding in a single web-role?

We have binary WCF service (netTcpBinding) in a web-role and an asp.net website (to take advantage of SignalR over azure's backplane). Due to the extremely low budget, we want to host them both in a web-role (as website doesn't allow non-standard-HTTP(S) ports).
So is it feasible to host them both in a web-role, to keep the SignalR/web-interface capabilities but also use the binary WCF/netTcpBinding pattern?
Edit:
Maybe I should've asked in the first place "How to host both asp.net (for SignalR) and WCF (for netTcpBinding) in single web-role and wire them up to the hosting IIS?"
As long as socket binding does not conflict - I cannot see why that should not be possible.
See here:
What default port does WCF use for nettcp when hosted by IIS?
https://msdn.microsoft.com/en-us/library/ms731810(v=vs.110).aspx

How do I configure webfarm for a simple asp.net demo application

I am just making a demo application and want to configure asp.net to use webfarm. How can I do so?
I have already configured my session mode to use SQL Server and it works perfectly. What should I do next? I am using Windows 7, SQL Server 2008 and Asp.Net 4.0 webforms.
You need multiple machines - set up the application on both of them and configure both web sites to have a common host name/header. You also need to setup a common machine key for encrypting view-state etc. In real web farm setup, you will have a s/w or h/w load balancer that will be route requests to either server based on load. In case, you don't have a load balancer then use your local hosts file to resolve the common host name - for example, for first couple of request, use machine 1 and then switch it to machine 2 for next few and so on.

windows service cannot access a webservice

We have two servers, both are containing a local application connecting to local web service, applications and services are identical on both servers.
One of the servers work just fine,
The other one is just dead, I have impression the the security configuration are different on those servers.
What prevents an application X from connecting a web-service, given that another application y on the same server can connect to it. and X is a windows service.
What I should check, what is chances?
Thanks
Check if there is any firewall that might need to some ports opened up.
Could there be any kind of AntiVirus or similar set up on one of the servers?
Basic troubleshooting of loosely-coupled applications means independent testing/verification of those services.
Can you access the web service locally through a different application, i.e. a web browser? If you can't reach the service through the browser, then the server configurations (at some level) are not identical.
Only after you're certain the service is reachable should you look into issues with the windows service.

Is it possible to manipulate an asp.net web application cache from outside the web?

I have a situation very similar to the one in this question:
Selective Cache clearing across load balanced servers (ASP.Net)
The difference is that due to our hosting configuration, I am unable to address individual servers by IP address. Assuming I cannot access specific servers via web requests, is it possible to access the HttpContext of a web application running on the same machine? I'm thinking I could accomplish this with a windows service that I could address by machine name, or alternately a console application, I just don't know if I can gain access to the web application cache either way.
You can expose content of the WebCache of an app through some Remoting/WCF code built into the web app. I hope you can use localhost to access it from an app on the same box.

Internal ASP.NET Web Application deployment to IIS

I have an ASP.NET 2.0 application that I am deploying to an IIS 6.0 web server. My ASP.NET application is being deployed as a virtual directory. Currently, this ASP.NET application is publicly visible on the internet. However, I need the ASP.NET application to run only inside of my corporate firewall.
How do I configure my application so that individuals outside of my company canNOT access/use the web application?
Thank you,
I would do one of the following:
if your app is standalone
1: create separate site for your application with DNS host name that is internal
if not
2: apply security to your virtual directory (windows auth can be seamless)
I suggest,
Use the corporate firewall to block all external requests to this IIS server. Consult your IT guys, as that's quite easy for them to do that for you.
Or use IP policy in IIS Manager to allow internal IP range but block all others. This is simply a workaround, which has worse performance than 1.
Probably a question best suited for ServerFault but you will need to have an IP address that is only internally viewable from the corporate firewall. You probably have an IT department so ask them for a internal only IP address and then assign the IP address they give you in IIS.

Resources