title: Converting to Mvc, ToolkitScriptManager ServiceReference
body: <p>So, I'm working in a hybrid web app/mvc application. Trying to do all new stuff in MVC and slowly changing some old webforms parts when there is time or a need for it. Using Razor.</p>
  
  <p>Currently I'm trying to bring some old javascript into an mvc page and I'm having some troubles with the ServiceReferences. Is there a way to get these working in Razor, I really don't want to have to re-write this js file, seems how it's about 1500 lines.</p>
  
  <p>I've got references to </p>
  
  <pre><code>&lt;script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js"&gt;   &lt;/script&gt;
  &lt;script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/mvc/2.0/MicrosoftMvcAjax.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>I'm guessing there must be some way to write this registration somewhere?
  In webForms it worked like this, for reference:</p>
  
  <pre><code>&lt;ajaxToolkit:ToolkitScriptManager ID="cnvScriptManager" EnablePartialRendering="true" ScriptMode="Release" LoadScriptsBeforeUI="true" CombineScripts="true" CombineScriptsHandlerUrl="~/CombineScriptsHandler.ashx" runat="server"&gt;
                  &lt;Services&gt;
                      &lt;asp:ServiceReference Path="~/ux/controls/util.asmx" /&gt;
                      &lt;asp:ServiceReference Path="~/ux/controls/menu/menu.asmx" /&gt;
                      &lt;asp:ServiceReference Path="~/ux/controls/menu/list.asmx" /&gt;
                      &lt;asp:ServiceReference Path="~/ux/controls/menu/tag.asmx" /&gt;
                      &lt;asp:ServiceReference Path="~/ux/controls/canvas/filter/filter.asmx" /&gt;
                      &lt;asp:ServiceReference Path="~/ux/controls/canvas/export/export.asmx" /&gt;
                  &lt;/Services&gt;
              &lt;/ajaxToolkit:ToolkitScriptManager&gt;
  </code></pre>
  
  <p>and then in the js you could do this nonsensical magic:</p>
  
  <pre><code>Xyz.Api.ListUXService.Fill(listParams, onFillListSuccess, onFailure, List);
  </code></pre>
  
  <p>I would love to have the time to convert it to jQuery and MVC, but, I don't :)</p>