tag:blogger.com,1999:blog-3150901600152577599.post6524261518714682237..comments2022-08-09T09:59:56.726+10:00Comments on Do The Right Things: Caveat in using Matlab DLL in ASP.NetL. Marhttp://www.blogger.com/profile/12467212807268032119noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-3150901600152577599.post-11135857683573772272014-10-03T10:47:24.389+10:002014-10-03T10:47:24.389+10:00Hi Bretton,
"I have been burned by using of ...Hi Bretton,<br /><br />"I have been burned by using of a COM DLL which works perfectly fine on my Win2k8 R2 Server / IIS7 at home but, for some strange reason, fails to load on my web hosting provider Wiin2k8 R2 / IIS7 system. "<br />Yes, this has been the most challenging task in our project. The project was conceived and tested in IIS5 and when it was about to roll out, IIS6 was used and then IIS7. The gradual tightening of security created all sort of failures - not from neglects in our code. Since then I have left the project and has not dealt with IIS7. But perhaps the steps I took to get it going may give you some idea of how to diagnose the problems - which typically is security related when dealing with IIS. The tool that got me out of the trouble is called Process Monitor http://technet.microsoft.com/en-us/sysinternals/bb896645, lots of patience pouring through logs and good understanding of underlying technology. Going back to my notes Matlab NE Builder's product does not use COM and relies on .Net integration with your IIS application. However, it does use Java deep down.<br /><br />"But what about the actual .dll themselves, myCompiledMatlabFunctions.dll and MWArray.dll, can they simply be dumped into the bin directory? Will ASP actually find them there?"<br />It all depends on the deployment. If you deploy the Matlab runtime using Matlab provided installation, the MWArray.dll is, from memory, deposited into the GAC. Hence you need not worry except to ensure that the deployed assembly matches the one you use in development. <br /><br />The ASP.Net supporting assembly must therefore, like with or without using Matlab, be deployed into the web application directories. Those assemblies must also be in strongly named. This is the reason why I spent so much effort to find a way to stamp a meaningful version number into NE Builder produced assembly. It is disappointing to see Matlab failing to appreciate this point, even when it was brought to their attention. Hope the new Matlab studio would have addressed this.<br /><br />"about the MCR itself. I understand nothing will happen until my hosting provider agrees to install it on their server? With the rights as IIS7, IIUSRS account or Network Service account?"<br />Yes, MCR needs to be installed as part of your IIS application deployment. Having said that, you then need to watch where Matlab runtime expands your scripts to. Failure to deal with that can cause runtime failure, even when all the security aspects are taken care properly.<br /><br />From memory, in our project we did not change the account type in the IIS application. We used whatever is the standard recommendation. May be "Network Service Account". Use Process Monitor to see what goes wrong if you are in trouble. <br /><br />For this kind of development, it is best to use a virtual machine as that can allow you to test your server application afresh. Good luck.<br /><br />One final note, I vaguely remember that MCR requiring write permission to some folder of the version number associated with the MCR. It does not write anything in it but demanding the write permission, which Network Service Account does not have. Hence we had to give it the permission required and we had not yet determined if such relaxation representing a security risk.<br /><br />Unfortunately I cannot locate my notes on this issue nor publishing it in my blog. My advice is if confronted with failure to run (usually the first time on a clean machine), use Process Monitor to look for "Access Denied" failure. <br /><br />As you can see, deploying Matlab to IIS is very troublesome and depending on your project requirement, it could be a strong influence to the successful adoption of your product.L. Marhttps://www.blogger.com/profile/12467212807268032119noreply@blogger.comtag:blogger.com,1999:blog-3150901600152577599.post-56864172075685586872014-10-03T00:59:53.214+10:002014-10-03T00:59:53.214+10:00Thank you for sharing your hard-earned experience ...Thank you for sharing your hard-earned experience with Matlab and ASP.NET and IIS.<br /><br />I am about to embark on a similar path, using C#, Matlab Assemblies and my ASP.NET web hosting provider.<br /><br />I have been burned by using of a COM DLL which works perfectly fine on my Win2k8 R2 Server / IIS7 at home but, for some strange reason, fails to load on my web hosting provider Wiin2k8 R2 / IIS7 system. <br /><br />I am trying to do my homework in advance of getting too far involved in this approach with using Matlab in my web application in case I encounter yet another mishap that my web hosting provider will have no clue about.<br /><br />One question, if I may. So far, I’m pretty clear on the compiling of the .NET Assembly step and adding References to the Web Application from within Visual Studio. But what about the actual .dll themselves, myCompiledMatlabFunctions.dll and MWArray.dll, can they simply be dumped into the bin directory? Will ASP actually find them there? (Please don’t mind my unusually long filename above…)<br /><br />Last but not least, about the MCR itself. I understand nothing will happen until my hosting provider agrees to install it on their server? With the rights as IIS7, IIUSRS account or Network Service account?<br /><br />/ Roger BretonRoger Bretonhttp://www.graxx.canoreply@blogger.comtag:blogger.com,1999:blog-3150901600152577599.post-87519402534085996652013-10-19T03:53:19.302+10:002013-10-19T03:53:19.302+10:00Nice! Fixed my problem! Thanks!Nice! Fixed my problem! Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3150901600152577599.post-86347769721457657022013-08-05T17:29:08.387+10:002013-08-05T17:29:08.387+10:00I have a matlab dll built from builder ne. I want ...I have a matlab dll built from builder ne. I want to use in in a asp.net page but I'm unable to do so.<br />Please guide me.Anonymousnoreply@blogger.com