Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use Hybrid Connections to Incrementally Migrate Applications to the Cloud

#1
Use Hybrid Connections to Incrementally Migrate Applications to the Cloud

<div style="margin: 5px 5% 10px 5%;"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud.png" width="513" height="399" title="" alt="" /></div><div><p>As the software industry shifts to running software in the cloud, organizations are looking to migrate existing applications from on-premises to the cloud. Last week at Microsoft’s Ignite conference, <a href="https://twitter.com/paulyuki99">Paul Yuknewicz</a> and I delivered a talk focused on how to get started migrating applications to Azure (<a href="https://youtu.be/2vp2ZCR6TbI">watch the talk free</a>) where we walked through the business case for migrating to the cloud, and choosing the right hosting and data services.</p>
<p><a href="https://youtu.be/2vp2ZCR6TbI?t=865">If your application is a candidate for running in App Service</a>, one of the most useful pieces of technology that we showed was <a href="https://docs.microsoft.com/en-us/azure/biztalk-services/integration-hybrid-connection-overview">Hybrid Connections</a>. Hybrid Connections let you host a part of your application in Azure App Service, while calling back into resources and services not running in Azure (e.g. still on-premises). This enables you to try running a small part of your application in the cloud without the need to move your entire application and all of its dependencies at once; which is usually time consuming, and extremely difficult to debug when things don’t work. So, in this post I’ll show you how to host an ASP.NET front application in the cloud, and configure a hybrid connection to connect back to a service on your local machine.</p>
<h2>Publishing Our Sample App to the Cloud</h2>
<p>For the purposes of this post, I’m going to use the <a href="https://github.com/paulyuk/modernizewithappservice">Smart Hotel 360 App sample</a> that uses an ASP.NET front end that calls a WCF service which then accesses a SQL Express LocalDB instance on my machine. <i /></p>
<p>The first thing I need to do is publish the ASP.NET application to App Service. To do this, right click on the “SmartHotel.Registration.Web” project and choose “Publish”</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/10/clip_image001.png"><img width="513" height="399" title="clip_image001" alt="clip_image001" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud.png" border="0" /></a></p>
<p>The publish target dialog is already on App Service, and I want to create a new one, so I will just click the “Publish” button.</p>
<p>This will bring up the “Create App Service” dialog.  Next, I will click “Create” and wait for a minute while the resources in the cloud are created and the application is published.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/10/clip_image003.jpg"><img width="784" height="588" title="clip_image003" alt="clip_image003" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud.jpg" border="0" /></a></p>
<p>When it’s finished publishing, my web browser will open to my published site. At this point, there will be an error loading the page since it cannot connect to the WCF service. To fix this we’ll add a hybrid connection.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/10/image35.png"><img width="1028" height="241" title="image" alt="image" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud-1.png" border="0" /></a></p>
<h2>Create the Hybrid Connection</h2>
<p>To create the Hybrid Connection, I navigate to the App Service I just created in the Azure Portal. One quick way to do this is to click the “Managed in Cloud Explorer” link on the publish summary page</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/10/clip_image005.jpg"><img width="679" height="336" title="clip_image005" alt="clip_image005" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud-1.jpg" border="0" /></a></p>
<p>Right click the site, and choose “Open in Portal” (You can manually navigate to the page by logging into <a href="https://portal.azure.com/">the Azure portal</a>, click App Services, and choose your site).</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/10/clip_image0061.png"><img width="381" height="319" title="clip_image006" alt="clip_image006" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud-2.png" border="0" /></a></p>
<p>To create the hybrid connection:</p>
<p>Click the “Networking” tab in the Settings section on the left side of the App Service page</p>
<p>Click “Configure your hybrid connection endpoints” in the “Hybrid connections” section</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/10/image36.png"><img width="946" height="1054" title="image" alt="image" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud-3.png" border="0" /></a></p>
<p>Next, click “Add a hybrid connection”</p>
<p>Then click “Create a new hybrid connection”</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/10/clip_image010.jpg"><img width="689" height="121" title="clip_image010" alt="clip_image010" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud-2.jpg" border="0" /></a></p>
<p>Fill out the “Create new hybrid connection” form as follows:</p>
<ul>
<li><b>Hybrid connection Name: </b>any unique name that you want<b /></li>
<li><b>Endpoint Host:</b> This is the machine URL your application is currently using to connect to the on-premises resource. In this case, this is “localhost” (<i>Note: per the documentation, use the hostname rather than a specific IP address if possible as it’s more robust)</i><b /></li>
<li><b>Endpoint Port: </b>The port the on-premises resource is listening on. In this case, the WCF service on my local machine is listening on 2901<b /></li>
<li><b>Servicebus namespace:</b> If you’ve previously configured hybrid connections you can re-use an existing one, in this case we’ll create a new one, and give it a name<b /></li>
</ul>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/10/clip_image011.png"><img width="389" height="525" title="clip_image011" alt="clip_image011" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud-4.png" border="0" /></a></p>
<p>Click “OK”. It will take about 30 seconds to create the hybrid connection, when it’s done you’ll see it appear on the Hybrid connections page.</p>
<h3>Configure the Hybrid Connection Locally</h3>
<p>Now we need to install the Hybrid Connection Manager on the local machine. To do this, click the “Download connection manager” on the Hybrid connections page and install the MSI.</p>
<p><b><a href="https://msdnshared.blob.core.windows.net/media/2018/10/clip_image013.jpg"><img width="599" height="206" title="clip_image013" alt="clip_image013" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud-3.jpg" border="0" /></a></b></p>
<p>After the connection manager finishes installing, launch the “Hybrid Connections Manager UI”, it should appear in your Windows Start menu if you type “Hybrid Connections”. (If for some reason it doesn’t appear on the Start Menu, launch it manually from “C:\Program Files\Microsoft\HybridConnectionManager &lt;version#&gt;”)</p>
<p>Click the “Add a new Hybrid Connection” button in the Hybrid Connections Manager UI and login with the same credentials you used to publish your application.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/10/clip_image015.jpg"><img width="783" height="139" title="clip_image015" alt="clip_image015" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud-4.jpg" border="0" /></a></p>
<p>Choose the subscription you used published your application from the “Subscription” dropdown, choose the hybrid connection you just created in the portal, and click “Save”.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/10/clip_image017.jpg"><img width="784" height="441" title="clip_image017" alt="clip_image017" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud-5.jpg" border="0" /></a></p>
<p>In the overview, you should see the status say “Connected”. <i>Note: If the state won’t change from “Not Connected”, I’ve found that rebooting my machine fixes this (it can take a few minutes to connect after the reboot).</i></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/10/clip_image019.jpg"><img width="785" height="489" title="clip_image019" alt="clip_image019" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud-6.jpg" border="0" /></a></p>
<p>Make sure everything is running correctly on your local machine, and then when we open the site running in App Service we can see that it loads with no error. In fact, we can even put a breakpoint in the GetTodayRegistrations() method of Service.svc.cs, hit F5 in Visual Studio, and when the page loads in App Service the breakpoint on the local machine is hit!</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2018/10/clip_image021.jpg"><img width="784" height="204" title="clip_image021" alt="clip_image021" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/use-hybrid-connections-to-incrementally-migrate-applications-to-the-cloud-7.jpg" border="0" /></a></p>
<h2>Conclusion</h2>
<p>If you are looking to move applications to the cloud, I hope that this quick introduction to Hybrid Connections will enable you to try moving things incrementally. Additionally, you may find these resources helpful:</p>
<p>As always, if you have any questions, or problems let me know <a href="https://twitter.com/AndrewBrianHall">via Twitter</a>, or in the comments section below.</p>
<p> </p>
</div>
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016