Domain or binding name for azure compute emulator - azure

I need to run a Web Role in azure compute emulator under domain name rather than localhost ip address (127.0.0.1). I can configure my project run regular web app on local IIS, so I can use actual domain name rather than development server ip addresses...
My application is very url specific because i use subdomains to define States (US States). For example, i need azure emulator to use something like:
http://wa.myapp.net, but not http://127.0.0.1 which doesn't make sense to me.
I have a lot of features that relay on sub-domains in my url. With regular web app I can configure this to run on IIS and set the url in my project (and bindings in IIS), but I don't see any way how I can do it in azure emulator.
Right now I have a work around. I just configured my local IIS to point to the application folder, I can run my app and then just attach my visual studio to iis process. But in this case some features don't work because azure role is not running... so it doesn't quite solve the problem...
Please, need an advice.
Thanks!

The MSDN article Configure a Web Role for Multiple Web Sites explains how to do this.
You can add extra bindings with a hostHeader attribute that specifies a custom domain in ServiceDefinition.csdef.
For example:
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="MyService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2013-03.2.0">
[...]
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="WebSvc" />
<Binding name="Endpoint1" endpointName="WebSvc" hostHeader="my.custom.domain.com" />
</Bindings>
</Site>
</Sites>
[...]
</WebRole>
</ServiceDefinition>
You still will need to setup the host override on your machine in C:\Windows\System32\drivers\etc\hosts, and navigate to the correct URL.

You cannot connect to the Dev Fabric from an external server. You can use fiddler on your server to redirect requests from another port to your azure fabric emulator. Hopefully, this is just for development, because it will not scale.
http://www.fiddler2.com/fiddler/help/reverseproxy.asp

Also a great tool to forward the request to your azure emulator: http://www.quantumg.net/portforward.php

Related

Handling the RoleEntryPoint.OnStart() event of an Azure Webrole in the second website

First Why I'm doing this:
I have a WCF service deployed as an Azure Webrole using HTTPS as endpoint. I need to have a custom "load balancer probe" set for this service. Azure load balancers does not support HTTPS, so I've deployed a second website with http endpoint to use it as my "load balancer prob"
So What's my problem?!
I have a webrole with two websites like:
<WebRole name="WebRole1" vmsize="Medium">
<Sites>
<Site name="Web" physicalDirectory="roles\WebRole1">
<Bindings>
<Binding name="Web" endpointName="WebRoleEndpoint" />
</Bindings>
</Site>
<Site name="Web2" physicalDirectory="roles\HealthProb">
<Bindings>
<Binding name="Web" endpointName="HealthProbEndpoint" />
</Bindings>
</Site>
</Sites>
...
it is recommended to handle the RoleEntryPoint.OnStop() to make sure you return the correct health status code to the loadbalancer (http://blog.mdavies.net/2013/04/27/custom-load-balancing-endpoints-azure-web-worker-vm-role/)
my problem is how I can hendle the RoleEntryPoint.OnStop() in my second website. though in the webrole I can easily do this by extending and overriding the RoleEntryPoint.OnStop(), in the second website I cant handle that event.
Is there any way that I can handle the OnStop or some similar event in the second website?!
Any process running on the VM can subscribe to the RoleEnvironment events. Simply add a reference to Microsoft.WindowsAzure.ServiceRuntime.DLL in your website project and then add a handler for the RoleEnvironment.Stopping event.
But instead of using a custom load balancer probe I would recommend just using the RoleEnvironment.StatusCheck event in your website. The purpose of the custom load balancer probe is to allow you to monitor the health of your w3wp process since the Azure runtime doesn't normally monitor this process. But if you are deploying a separate site to implement the custom LB probe then you really aren't monitoring your main w3wp process. In this case you are better off just using the StatusCheck event which can implement your LB logic, and then you get the Stopping/OnStop behavior for free.

Getting single Azure WebRole to support multiple domains on seperate SSL certificates

I have an Azure Cloud project containing a cache role, a worker role, and a web role. I have a new requirement to have the Web Role service two separate domains each with a different SSL Certificate. They also need to be bound to the same port. I don't have a multi-domain cert since they are owned by different people.
To do this I think I need to run separate role instances of the web role so I don't have conflicts with the port/cert bindings. Beyond the domain name and the SSL cert the project is the same. Can anyone tell me an efficient way to accomplish this?
In the short term I would be willing to run on separate ports but have not been able to get that to work either.
As you said a single WebRole only has one external IP and therefor I think by using in the service definition (.csdef) file you can only have one certificate for a https endpoint on port 443. If you had a cert with multiple SANs it probably would be possible to serve different sites on the same port.
This blog post describes what you are looking for (setting up the SNI SSL extenison supported by IIS 8.0):
http://www.vic.ms/microsoft/windows-azure/multiples-ssl-certificates-on-windows-azure-cloud-services/
The configuration options for multiple web sites in one Web Role are described in the MSDN article: Configure a Web Role for Multiple Web Sites
As the short term solution you could try to use additional end-points:
<InputEndpoint name="HttpsIn2" protocol="https" port="444" certificate="foo.com" />
<InputEndpoint name="HttpsIn3" protocol="https" port="445" certificate="bar.com" />
and use them in additional sites:
<WebRole name="Web" vmsize="Small">
<Sites>
<Site name="Web"> ... </Site>
<Site name="foo" physicalDirectory="..\..\..\Web\Content">
<Bindings>
<Binding hostHeader="www.foo.com" name="HttpsBindingA" endpointName="HttpsIn2" />
</Bindings>
</Site>
<Site name="bar" physicalDirectory="..\..\..\Web\Content">
<Bindings>
<Binding hostHeader="www.bar.com" name="HttpsBindingB" endpointName="HttpsIn3" />
</Bindings>
</Site>

Protect test/beta site running in azure

We're developing a new website running in azure. We are currently developing against the local azure dev environment. But now we need to publish and test the site in the real Azure world. But we would like to run in a "closed" environment, where only know users have access, as the site should not go live yet. Any suggestions to accomplish this?
/Rasmus
Windows Azure has something called 'staging mode', see this post: http://sevans.info/2010/10/10/windows-azure-staging-model/
It's very powerful, and exactly what you need as far as I can see.
You could remove the endpoints of your instance configuration, so there will be no forwarding through the load balancer. After that you could use the Remote Desktop to log into your azure instance and test your web application.
Above suggestions are great and I would also like to add two more in this list as well:
Using production deployment and having a dummy index/default page with directory browsing disabled (already set as default) So when someone come you your site there is nothing they will see. And as there is no directory browsing so they can not guess the page*.aspx to visit your site. This will keep your production site running and you can test it from outside.
Removing your instance form Load Balancer while keeping your instance healthy. This will require you to test the Azure Application by RDP to your instance and then launch internally. If you wish to do so here is the Powershell based trick.
You could restrict the IP addresses that are allowed to access your app if you have a static IP address. As per this link: https://azure.microsoft.com/en-us/blog/ip-and-domain-restrictions-for-windows-azure-web-sites/
Developers can use IP and Domain Restrictions to control the set of IP addresses, and address ranges, that are either allowed or denied access to their websites. With Windows Azure Web Sites developers can enable/disable the feature, as well as customize its behavior, using web.config files located in their website.
Here's the code:
<system.webServer>
<security>
<ipSecurity allowUnlisted="false" denyAction="NotFound">
<add allowed="true" ipAddress="123.456.0.0" subnetMask="255.255.0.0"/>
</ipSecurity>
</security>
</system.webServer>

Wildcard binding when using the Azure Accelerator for web roles

This relates specifically to the Windows Azure Accelerator for web roles.
How can I configure the Website manager web role so that it only responds on a certain host name and have one of the hosted sites used a wildcard binding?
So far I've given the web role a specific hostname and added a binding to my child site with an empty host name. Looking in IIS on the remote machine, everything looks fine.
However, I'm finding that the wildcard entry has little effect and I can only get to the web site if I set up specific bindings.
This is caused by the way in which Azure handles "wildcard" bindings. Specifically, a binding with IP "All Unassigned" doesn't actually work. I've yet to find out why - MS support are working on that one.
I've added the patch to fix the Accelerator on codeplex - http://waawebroles.codeplex.com/workitem/5
[Update]
Have blogged full details at http://ben.onfabrik.com/posts/azure-accelerator-wildcard-bindings
Simple, open ServiceDefinition.csdef and add hostheader to WebRole sites bindings. Result should look somewhat like this:
<Site name="Web">
<Bindings>
<Binding name="HttpIn" endpointName="HttpIn" hostHeader="webadmin.mytest.com" />
</Bindings>
</Site>
Unfortunately sites without defined header still wont work anywere else than on local machine (remote desktop) and will fail with:
Service Unavailable
HTTP Error 503. The service is unavailable.

Cannnot access .svc on a RESTFul WCF Service deployed on local IIS WebServer

I need help, I'm new to the WCF world having recently made the transition from SOAP Webservices.
The WCF service works well when I run in from the VS2008 ASP.NET Development Server i.e. Debug Mode. The problem comes when I try to access the service via IIS.
I've setup a website on my local IIS Webserver hosted on port 8082 (http://localhost:8082) and have created a VirtualDirectory (1.0) that points to the physical directory that contains my WCF Service code. The Website is setup to do ASP.NET 2.0.50727. I can get to the landing page and also an assortment of .aspx pages but when I try to access the Service.svc, the browser never gets there and just sits idling.
http://localhost:8082/1.0/Service.svc
My question is what setup am I missing to get the service to work from inside IIS since I already know it works under the development server.
I'm attaching part of my web.config if that would help.
<system.serviceModel>
<services>
<service name="Service1" behaviorConfiguration="Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="wsHttpBinding" contract="IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
You talk about RESTful service, yet you're using the wsHttpBinding.... that's not the REST binding - that would be "webHttpBinding".
For the most part, WCF services ARE SOAP-based - any of the bindings except for the webHttpBinding are SOAP endpoints, so your wsHttpBinding endpoint is definitely not RESTful in any way, shape or form. You can communicate with it using e.g. SoapUI or better yet - the WcfTestClient in your Visual Studio folder.
You cannot however expect to get XML shaped data back from it by just browsing to that URL.
Marc
By default IIS 7.0 is not configured
for WCF services, we are going to
configure IIS 7.0 to run WCF services
i will break up the whole procedure in
steps.
http://basitblog.wordpress.com/2010/01/12/deploy-wcf-service-over-iis-7-0/

Resources