1. Download and Install Visual Studio
If you haven’t done so already go ahead and download it.
2. Download and Install FluorineFX
3. Creating a FluorineFX ServiceLibrary Project in Visual Studion 2008 Express
- Open up Visual Studio
- File -> New Project…
- Select Visual C# under Project Types.
Under Templates select FluorineFx ServiceLibrary
You can give your “Library Part” of the project an arbitrary name but I am going to leave it as it is: ServiceLibrary1
Select a location for your project. For simplicity reasons I am saving my project in a folder called “MyFluorineProject” on my Desktop. To do that just click on the Browse button and create a new folder on your desktop.
Make sure you uncheck the checkbox “Create directory for solution”.
Click OK.
Here’s a screenshot of my settings. - Once you click of the following error message (might) pop up:
Don’t mind that error for now. It will appear a few more times but we will take care of it in a bit.
- In your Solution Explorer in Visual Studio expand the References tab.
- Got to Project -> Add Reference -> Browse Tab
And browse to the “FluorineFx.dll” which — in case of a default installation — can be found here: C:\Program Files (x86)\FluorineFx\Bin\net\3.5\
So simply browse to that directory, select the file, click OK and notice how the warning disappears.
4. Creating a FluorineFx ASP.NET Web Site
- In Visual Studion go to File -> New Web Site…
- In the Templates dialog select “FluorineFx enabled ASP.NET WebSite”
- Make sure C# is selected as the programming language
- Click browse and navigate to the folder that you created under Step 3 of this tutorial.
I’ve created my directory called “MyFluorineProject” on my desktop. So I am simply navigating to that directory, select it and click Open.
Once you’ve done that your path should look somewhat similar to this: C:\Users\Dan\Desktop\MyFluorineProject - Click OK
Creating a new FluorineFx ASP.NET Web Site After clicking OK the error message from above pops up again saying that the Search path for assemblies could not be found. And again we are going to fix it straight away. Go to Website -> Add Reference… -> Browse Tab and browse to the same directory as you did before. C:Program Files (x86)FluorineFxBin
et.5 Locate the file called “FluorineFx.ServiceBrowser.dll”, select it and click OK. Now set the Web Site you have just created as a StartUp Project by right-clicking on your Web Site Project in the Solution Explorer and selecting “Set as StartUp Project” Set up your Web Site as a StartUp Project Finally right-click on the Console.aspx file and select “Set As Start Page” to make the Console.aspx page your start page. Setting the Console.aspx Page as your Start Page
- Run the project by going to Debug -> Start Without Debugging or simply pressing CTRL + F5 on your keyboard.
-
Your default web browser should open up showing you something very similar to this:
-
Drill down the Services tree until you hit the “Echo” function.
Note that this function was automatically created by Visual Studio in your Sample.cs file in the Service Library “Part” on project creation. The function is fairly simple but it’s still worth to have a look at the code:
public string Echo(string text)
{
return "Gateway echo: " + text;
}
-
As I said, it is fairly simple and the only thing it does is to return the text you pass to the function as a parameter.
-
Now comes the amazing part!
-
Drilled down in the Service tree of your FluorineFx Console in the Echo function, type in a sample text in the text input control and press the “Call” Button.
If everything goes well you well see an appropriate output in the text area below.
Notice that I am talking in Flex terms now. (Text input control, text area) That’s right! The whole FluorineFx Console Page is a Flash Application. Just press the right mouse button anywhere on the page and see for yourself.
So from this point we know that we have successfully setup our ASP.NET backend with FluorineFx. Hurray! On to the next step in this tutorial. -
Just make sure it really works. After clicking the “Call” Button you should see something like this:
First test with the Fluorine Console5. Creating the Flex Project and connecting it to the ASP.NET backendIn Flash Builder create a new Project with the following settings. I am calling my project “FluorineFlexApp“Creating a new Flex Project
5. Creating the Flex Project
- In Flash Builder create a project with the following settings:
- For simplicity just select “Use ASP.NET Development Server” in the next screen and click on Finish.
- I am going to pop in the application code and we will go through it afterwards.
</div>
<div><?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="<a href="http://ns.adobe.com/mxml/2009">http://ns.adobe.com/mxml/2009</a>"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600"
initialize="application1_initializeHandler(event)"></div>
<div><fx:Declarations></div>
<div><s:RemoteObject id="ro"
destination="fluorine"
source="ServiceLibrary1.Sample"
fault="onFluorineFault(event)"></div>
<div><s:method name="Echo" result="onFluorineResult(event)" /></div>
<div></s:RemoteObject></div>
<div></fx:Declarations></div>
<div><fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.messaging.ChannelSet;
import mx.messaging.channels.AMFChannel;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;</div>
<div>public var startTime:Number;</div>
<div>//set up the AMF channel:
//this eliminates the need to reference any config files--yay!
protected function application1_initializeHandler(event:FlexEvent):void
{
var amfChannel:AMFChannel = new AMFChannel("myAMF", "<a href="http://localhost:4444/dantest/Gateway.aspx">http://localhost:4444/MyFluorineProject/Gateway.aspx</a>");
amfChannel.pollingEnabled = false;
var myChannelSet:ChannelSet = new ChannelSet();
myChannelSet.addChannel(amfChannel);
ro.channelSet = myChannelSet;
}
//SEND FUNCTION (when button is pressed):
public function fluorineSend():void{
lblTimer.text="";
startTime = new Date().time;
ro.Echo(txtInput.text);
}</div>
<div>//RESULT FUNCTION
public function onFluorineResult(event:ResultEvent):void
{
lblTimer.text = "The Process took " + (new Date().time - startTime) + " ms";
lblEcho.text=event.result.toString();
}</div>
<div>//FAULT FUNCTION
public function onFluorineFault(event:FaultEvent):void
{
Alert.show("Fluorine Fault" + event.fault.toString());
}</div>
<div>]]>
</fx:Script></div>
<div><s:BorderContainer width="400" height="300" x="100" y="100"></div>
<div><s:VGroup width="400" height="300" verticalCenter="0" horizontalCenter="0"></div>
<div><s:TextArea text="Enter Text to Echo with Fluorine:" width="198" /></div>
<div><s:TextInput id="txtInput" width="198" /></div>
<div><s:Button label="Call Fluorine Service" click="fluorineSend()" /></div>
<div><s:Label id="lblEcho" text="Echo Text Here" width="379" height="35" fontWeight="bold" fontSize="17" textAlign="left"/></div>
<div><s:Label id="lblTimer" /></div>
<div></s:VGroup></div>
<div></s:BorderContainer></div>
<div></s:Application></div>
<div>
- If you are a Flex Developer the code should be pretty self explanatory.
- The most important line to notice is this one:
</div>
<div>var amfChannel:AMFChannel = new AMFChannel("myAMF", "<a href="http://localhost:4444/dantest/Gateway.aspx">http://localhost:4444/MyFluorineProject/Gateway.aspx</a>");</div>
<div>
- You need to define the right path to the Gateway.aspx of your Fluorine Project that we have created in the first steps of this tutorial.
- You might wonder where I got the 4444 after local host from.
- Go to your taskbar and you will see two Development Server running. One for your Flex Project (remember you selected ASP.NET as a backend technology) and one for your actual ASP.NET — Fluorine Project.
- Just get the number from the Fluorine Project.
- You can even try to type that link into your browser. If you get an empty page it works!
- Finally Run your Flex Application and if everything went well you have sucessfully established a connection from a Flex App to your ASP.NET backend.






Hi, thanks, really good tutorial.
I just got a problem when I finally run my Flex app, it says :
Fluorine Fault[RPC Fault faultString=“Failed to locate the requested type ServiceLibrary1.Sample” faultCode=“Server.Processing” faultDetail=“null”]
Do you know why ?
Thx
Hi Jah,
Thanks! Hmm sounds like your Flex app is not able to find the Service Library. Did you make sure the port number in your Flex App matches your Localhost port number?
If that doesn’t help can you please paste a code snippet so I can see how you configured your remote object?
Cheers,
Dan
Hi,
I am trying to set up FluorineFX with .NET 4.0 using Visual Studio. Can you provide me some guidance on that. I have checked out the code from SVN but not sure what to do after that.
Thanks!
Hi there!
It should be the same procedure as described in my tutorial. Which part is causing you problems?
@rosh
I meant Visual Studio 2010.
@Jah Jah
Sounds like you may need to register fluorinefx as a managed module in IIS. Just stick this somewhere in your web.config
Hellow, i have some problems too with vs2010… The Flourine Template Projects are not visibles in New Project Wizard.
NOTE: I Have vs2010 with spanish languaje.
everything is fine but Service library methods are not shown.
what could be the reason.
Hola buenas tardes tengo visual studio 2010, las plaltillas de fluorine no se muestran, me podrias asesorar que debo hacer
Francisco
Sorry mate, no ablo espanol. I’d be happy to help you out in English. If only I knew what you were trying to say, mate
Hi, I need to connect with Visual Studio 2010 Flex4 by fluorine, could you advise me please
Francisco
Hey Francisco,
I’ve only done it with MS Visual Studio 2008 Express.
But I would assume it’s pretty much the same. So which step of the tutorial seems to be different?
Hi Dan!
Thanks for a good tutorial.
Just like Francisco I need to do this with VS 2010. However, no Flourine-templates are provided for VS 2010.
I have checked out and compiled the .NET 4.0 source, but there is very litle documentation on how to proceed from there.
Any chance that you can provide the code for your sample app?
Johan
Hi guys,
sorry that I can’t help you out much but I’ve never done it with VS2010. I always had the Express version and never beyond 2008.
I’m sure Microsoft has changed more than just a few things. May I ask what’s wrong with using the 2008 version? It’s for free and it does the job. But if you really need to do it with VS2010 I’m not the guy to ask. Sorry but I’m just too busy with my job at the moment. Cheers, Dan
Hi, note that templates do not appear in visual studio 2010 fluorine
thanks,i make it~~
by the way , fluorine does not support vs2010 by default ~
hi,dan
I found there is an easy way,add the endpoint property
instead of the channelSet property
Hi
could you suggest something on Load testing of flex application using VSTS 2010.
Please let me know if you have any knowledge related to it.
Thanks
Hey Dan,
In our app we use Flex, .Net and SQL. We want to create a personalized test environment for every .Net developer where we have installed IIS 7 on his machine so that we will place all Flex related executables from bin-release folder there. This way when Flex UI opens up (.html file from Flex being used as a website through IIS) then the debugging goes inside .Net code on that machine and .Net developer is able to debug his code effectively.
Is that really possible? We are trying to figure this out since last 1 week but the problem we are getting is that Flex is unable to create a connection with .Net right from the first call.
In our app we use services-config.xml and remoting-config.xml for connectivity and We have placed them in WEB-INF/flex folder. The path in former correctly points to http://localhost:80/Gateway.aspx. In Flex we are using AMFChannel class the endpoint points to http://localhost:80/Gateway.aspx only. Then why cant we connect?
Please suggest.
@Shubhra Bhushan
We faced a similar issue.
http://stackoverflow.com/questions/12734141/website-using-fluorine-fx-borken-during-migration/12745038#12745038
Turns out all i had to do was to make the run the app pool in classic mode instead of integrated mode. the issue was fixed.
Dan, thank you so much for the tutorial.
For all people asking about VS2010, here is the solution.
I have found a post talking about FluorineFX for visual studio 2010 templates in Chinese
link http://www.riafan.com/fluorinefx-template-for-visual-studio-2010/
you can download the templates from here:
https://skydrive.live.com/?cid=85de418bbe50ed49&id=85DE418BBE50ED49!170 (you might have to try multiple times to open the link).
then copy the templates to:
C:\Documents and Settings\User\My Documents\Visual Studio 2010\Templates\
and create a new project (Fluorine library and website)
——————————————————————————
Another way (without the above templates) is to open a blank solution in VS2010, to to Tools > Library Package Manager:
then type (Install-Package fluorinefx) to download the Fluorine Library.
to download an example (source: http://nuget.org/packages/fluorinefx.sample):
Type (Install-Package fluorinefx.sample).
source: http://nuget.org/packages/fluorinefx
Regards,
MS
Set the Value of “amfChannel.source ”