How to implement on-premise Stocktrader web app against Azure BSL
-
lundi 30 avril 2012 07:07
Hi, I have followed the .NET StockTrader 5.0 Installation and Configuration guide up to page 73.
I currently want to have the StockTrader web app on-premise calling the Business Services Layer in Azure.
At the moment I successfully have the application layers running separately for the web app, bsl and order service both in Azure and on-premise (localhost).
The question I have is, how can I configure this so that it runs the web app locally (on-premise), but the web app calls the BSL in the cloud?
My first thought was that I needed a new Connected Service definition to describe the remote service.
So I went and had a look at the way the BSL was set up in the Azure version of the app, hoping to copy the required attributes to the on-premise configweb.
So in the on-premise configweb, I selected Connected Services.
Clicked Add Service
Typed my address to my hosted Azure service (I've altered it here, best to be safe!): https://[my]stocktraderbsl.cloudapp.net:443/config.svc
Selected Client_ConfigSvc_BasicHttpBinding_T_Security
Entered UserId: azurebslcsuser (I also tried azurebsloperationuser)
Password: same but with #1 on the end.
Then clicked on Get Remote Services!
It fails with "Cannot Connect
Please make sure the address to the remote configuration service endpoint is correct and you have chosen the appropriate client configuration/binding. For example if specifying https, you must choose a client configuration using https/transport security."
What am I doing wrong?
Toutes les réponses
-
lundi 30 avril 2012 08:01I should add that I have tested the url https://[my]stocktraderbsl.cloudapp.net/config.svc and it returns a service page successfully.
-
mardi 1 mai 2012 02:39
I still haven't solved this.
What I am trying to demonstrate is that this architecture is essentially an each way bet for companies that have issues committing to the cloud now, but know they may change their mind in future. I will be demonstrating this, and I want to show that it is relatively easy to switch from an on-premise business layer to a cloud hosted business layer.
-
mardi 1 mai 2012 15:31Modérateuryou are on the right track. I will look at later this afternoon. You should not have to enter any credentials when you click get remote services button. There is a config setting that is set on BSL that says let anyone connect up, it will find and return the connected service credentials automatically by default (unless you chage this setting for the bsl in azure). Once successfully connected, you then click use default user credentials, selecting azurebsloperationuser (it should be selectable in the dropdown list once connected). But I will go through the steps and let you know later today. It should work fine.
Greg Leake, Microsoft
-
mercredi 2 mai 2012 00:44Modérateur
I figured it out. My bad. I have a binding definition in the Web app that accidently has my lab's proxy server configured--something I used during testing on release. This is preventing the Web app config svc from communicating over the internet. Look in the StockTraderWebApplication VS solution. Open the Web app project "Trade". Open Web.config. Find the following:
<binding name="Client_ConfigSvc_BasicHttpBinding_T_Security" closeTimeout="00:00:30" openTimeout="00:00:25" receiveTimeout="00:15:00" sendTimeout="00:1:00" allowCookies="true" bypassProxyOnLocal="true" hostNameComparisonMode="StrongWildcard" maxBufferSize="524288" maxBufferPoolSize="524288" maxReceivedMessageSize="524288" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="false" proxyAddress="http://192.168.4.1:8080">
<readerQuotas maxDepth="512" maxStringContentLength="262144" maxArrayLength="262144" maxBytesPerRead="196608" maxNameTableCharCount="262144"/>
<security mode="Transport">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
</security>
</binding>And change to useDefaultWebProxy="true" and delete the proxyAddress=http://192.168.4.1:8080 , save the web.config file.
Now rebuild the solution. (actually you don't need to really, web.config change should be picked up by IIS immediately)
Now repeat your steps to add a Connected Service Definition to trade web app, by logging into configweb to the local StockTraderWebApplication (http://localhost/trade/config.svc). Choose Connected Services, then Add Connected Service button. Type in address to your deployment:
https://[yourdnshere]azurestocktraderbsl.cloudapp.net:443/config.svc. Just hit Get Connected Services button. It should work fine now. You can leave the defaults in the page that comes back (scroll to bottom); except check off: "Apply Default UserName Client Credentials:, and choose from dropdown "azurebsloperationuser". This is the username/password (stored in config repository) that will be passed, over https, for authentication by the BSL from requests from your trade web app. Click Add button, wait for confirmation.
Next, choose Connections, Add Connections in ConfigWeb. The new Azure-hosted service will now be listed, just click Add button, and you are off and running. To now configure the Web app to actually route all business service requests to the Azure service (vs. in-process activation), choose Edit Custom Settings for the Web app (home page of configweb).
Find and edit AccessMode setting. Change to "<label for="MainContent_RadioButtonListValidValues_2">Azure BSL wsHttp security = TransportWithMessageCredential: UserName"--this is the third radio button choice down. Click Update button. Bring up the Service Map view in configweb. You can see the new deployment topolgy, with your local web app nodes, and your Azure web role instances and sql azure databases now.</label>
Now, login to the http://localhost/trade web application as uid:0, xxx (or whatever). The web app is running locally, just UI. Your stocktraderdb is now SQLAzure (as created on install via MSI); and all reuqests are serviced by your Azure BSL delpoyment.
Let me know if this works, I will fix the bad proxy server address in the WCF binding in web.config in the next release.
-Greg
Greg Leake, Microsoft
- Marqué comme réponse Tony Wright samedi 5 mai 2012 05:33
-
samedi 5 mai 2012 04:51
Hi Greg,
Thanks for that.
I click on the Get Remote Services! and it connects to the service... the Host Name identifier is Azure StockTrader Web Application
BUT
In "Select From Available Remote Endpoints:" the dropdown box is empty and it has an error message that appears to prevent me from moving on, as follows: "Either this host does not expose services via the Config Service (try as a Generic Service); or you already have established definitions for all available services this virtual host exposes."
When I go to the configuration service service page, it does display, the default page. https://[mydns]stocktraderwebapp.cloudapp.net/config.svc
"ConfigurationService Service
You have created a service.
To test this service, you will need to create a client and use it
to call the service. You can do this using the svcutil.exe tool from the command
line with the following syntax:svcutil.exe https://xx.xx.xx.xx/config.svc?wsdl
This will generate a configuration file and a code file that
contains the client class. Add the two files to your client application and use
the generated client class to call the Service. For example:C#
class Test { static void Main() { ServiceConfigurationClient client = new ServiceConfigurationClient(); // Use the 'client' variable to call operations on the service. // Always close the client. client.Close(); } }
What do I do next?
Regards,
Tony
-
samedi 5 mai 2012 05:14Oops, I put the webapp config service url in, instead of the BSL config service url.
-
samedi 5 mai 2012 05:33
Ok, it appears to be working now!
Thanks for the help Greg.
-
mardi 8 mai 2012 22:11Modérateur
Glad to help.
Greg Leake, Microsoft

