Assign different IIS App pool to a web service using WIX - iis

I created a new IIS Application pool named "myAppPool" and I'm trying to assign my wcf web service, "myWebService" to this newly created app pool. is it possible for me to do it using wix?
I've done some research and found this link -> http://blog.bartdemeyer.be/2013/10/create-an-installer-for-website-with-wix-part-3/ which is helpful but, he installed a website first and assigned the app pool to the new web site. But I need to assign the web service to a different app pool without creating a new website.
Has anyone done this before? Is this possible or applicable using WIX?
Thanks in advance!

If you want to add the service as a web application under an existing site, you should be able to do something like this:
<Component Id="MySite.MyWebService" Directory="TARGETDIR" Guid="[GUID]">
<CreateFolder />
<iis:WebVirtualDir Id="VirtualDir.Service.MyWebService" Alias="MyWebService" Directory="TARGETDIR" WebSite="MySite">
<iis:WebApplication Id="Application.Service.MyWebService" Name="MyWebService" WebAppPool="MyAppPool" />
</iis:WebVirtualDir>
</Component>
The virtual directory should be where your service "lives".

Related

Make WebAPI internal to Azure

I need to make a web api internal to Azure cloud. What attributes or setting to make?
setup
I have two application deployed in azure cloud.
1st is a frontend MVC5 application with UI.
The 2nd is a WebAPI.
The user external to cloud can make calls only to 1st application.
The 1st application calls the 2nd appliction internal to cloud.
i don't what users external to cloud make calls to 2nd application.
How do i restrict it?
The 1st application is a website deployed in cloud. Second application is also a MVC5 website with only WebAPIs deployed in cloud.
Thanks in advance.
Since Azure Web Sites don't support virtual networks yet, what you can do is configure IP restriction.
Place this section in your Web.config file and replace the IP address with the MVC5 address.
<security>
<ipSecurity allowUnlisted="false"> <!-- block everybody, except those listed below -->
<add ipAddress="999.999.999.999" allowed="true"/> <!-- allow requests from the MVC5 app -->
</ipSecurity>
</security>
One caveat is that all Web Sites from the same Azure region are sharing the same IP address. To get around this, you need to configure SSL as described here: http://blogs.msdn.com/b/benjaminperkins/archive/2014/05/05/how-to-get-a-static-ip-address-for-your-microsoft-azure-web-site.aspx

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>

Domain or binding name for azure compute emulator

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

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