Using Smile.dll on webpage

The engine.
Post Reply
tloy1966
Posts: 20
Joined: Thu May 12, 2011 2:40 am

Using Smile.dll on webpage

Post by tloy1966 »

Hi

Thanks for your guild before, i start using SMILE in web-page

but i got some problems...so plz help me :shock:

My web-page is works fine in Visual Studio 2010, but when i want to build web-page with IIS(Internet Information Services), problem just happened...

It shows the following message.....
Invalid node identifier: SP001
Smile.SmileException: Invalid node identifier: SP001

[SmileException: Invalid node identifier: SP001]
Smile.Network.ValidateNodeId(String nodeId) +194
Default3_BN6.Button1_Click(Object sender, EventArgs e) +421
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Is there any advice such that i can follow? Thanks :D
tloy1966
Posts: 20
Joined: Thu May 12, 2011 2:40 am

Re: Using Smile.dll on webpage

Post by tloy1966 »

I was using following test to simpfly my question

I use SetEvidence to set evidence
protected void Button1_Click(object sender, EventArgs e)
{
Network net = new Network();
net.ReadFile("Network1.xdsl");
net.UpdateBeliefs();
net.SetEvidence("Node1", "State11");
}
then IIS message is
Invalid node identifier: Node1

Smile.SmileException: Invalid node identifier: Node1

[SmileException: Invalid node identifier: Node1]
Smile.Network.ValidateNodeId(String nodeId) +194
_Default.Button1_Click(Object sender, EventArgs e) +60
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
:( :( :( :( :( :( :( :(
orzech
Posts: 51
Joined: Wed Aug 04, 2010 11:40 pm

Re: Using Smile.dll on webpage

Post by orzech »

First of all make sure that your application works in a desktop enviroment (that is in a form of Desktop/Console .NET application). If that works fine, then try making a web-application. Did you check if your model loads correctly? Are you sure that you've configured IIS properly (i.e. the service has access to local files)?
tloy1966
Posts: 20
Joined: Thu May 12, 2011 2:40 am

Re: Using Smile.dll on webpage

Post by tloy1966 »

orzech wrote:First of all make sure that your application works in a desktop enviroment (that is in a form of Desktop/Console .NET application). If that works fine, then try making a web-application. Did you check if your model loads correctly? Are you sure that you've configured IIS properly (i.e. the service has access to local files)?
Thanks for your reply

I think it works fine in desktop environment, because i read your useful documentation http://genie.sis.pitt.edu/wiki/SMILE_Documentation and use .NET application to create a xdsl file, that was works fine~

And is there any way so i can check model loads correctly?I think this is the problem!!!!

honestly i dont think i configured IIS properly :oops:

do you have any recommend for me to read some paper or books? Thanks :)
tloy1966
Posts: 20
Joined: Thu May 12, 2011 2:40 am

Re: Using Smile.dll on webpage

Post by tloy1966 »

Hi

i would like to share my way to run SMILE on web

i use Visual Studio 2010 with c# and SQL server 2008

the main code is like the following...


Step1

Code: Select all

  Network Mnet = new Network();
        Mnet.ReadFile("CMBnetSix.xdsl");
        Mnet.UpdateBeliefs();

       foreach (string Msigns in inputSignSplit)  // i want to set some evidence
            { Mnet.SetEvidence(Msigns, "present"); }

       //output the probability to gridview or other table
Step2

i put the .xdsl file in
C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0
VS2010 will read .xdsl from here
orzech
Posts: 51
Joined: Wed Aug 04, 2010 11:40 pm

Re: Using Smile.dll on webpage

Post by orzech »

As far as I know Network.ReadFile() returns a boolean which indicates if the network was loaded correctly or not. Thus, your initial code should look like:

Code: Select all

Network Mnet = new Network();
if (Mnet.ReadFile("CMBnetSix.xdsl"))
{
        Mnet.UpdateBeliefs();
}
else
{
    // UPS! File not loaded!
}
tloy1966
Posts: 20
Joined: Thu May 12, 2011 2:40 am

Re: Using Smile.dll on webpage

Post by tloy1966 »

OK i see!!!

thanks u !! :wink:
Post Reply