MATLAB: Render WebFigure in Microsoft Visual Studio on Windows 64-bit System

64bitiisMATLAB Compiler SDKwebfigurewebfiguresservice

How to render webfigure on a 64-bit Windows platform?

Best Answer

Please follow the steps below to render "webfigure" control when using Microsoft Visual Studio 2013 or 2015 to create a website. The example here uses MATLAB R2013b(64-bit). If you use a different release, the WebFigureService version and PublicKeyToken in Default.aspx and web.config would be different but they are auto retrieved so you do not need to do anything.
Following would be the final output of following the steps mentioned in this document:
Please follow the steps mentioned below:
1. Start Visual Studio File -> New -> Web Site.
2. Select ASP.NET Web Forms Site
3. Set .NET Framework to .NET Framework 4 and click next to create project for the web site.
4. Select both the check boxes in Debug -> Options -> Projects and Solutions -> Web Projects. See screenshot "web projects" attached below.
5. Change "Configuration properties" of solution. Select your solution in Solution Explorer. Set Project -> Properties -> Configuration Properties ->Platform to "Any CPU"
6. Add WebFiguresService.dll as a reference to your project from  _matlabroot_\toolbox\dotnetbuilder\bin\_arch_\v4.0\WebFiguresService.dll
7. Tools -> Chose Toolbox items and select WebFiguresService.dll. Follow the steps in the link below:
8. Open Default.aspx in Designer view by right clicking this file in Solution Explorer. Drag and drop web figures control in your Default.aspx page.
9. Add following code to your "Web.config" file before <system.web> tag
<appSettings>
<add key="PageInspector:ServerCodeMappingSupport" value="Disabled"/>
</appSettings>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="webfigure" path="__WebFigures.ashx" verb="GET" type="MathWorks.MATLAB.NET.WebFigures.Service.Handlers.Factories.Http.WebFigureHttpHandlerFactory"/>
</handlers>
</system.webServer>
10. Add the following code before closing tag for "assemblies" that is </assemblies>:
<remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
11. Run the solution.