Last post Oct 12, 2013 03:40 AM by gcapnias
Oct 09, 2013 03:04 PM|dean5757|LINK
I have a fully functional ASP.Net Webfrms application utilizing the AjaxControlToolkit in my GUI. Everything works fine, when running it within Visual Studio using IIS Expresss. Once I selecte to run the application through my local normal IIS server I
receive the following error:
The assembly 'AjaxControlToolkit, Version=184.108.40.2065, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' does not contain a Web resource that has the name 'WebForms.js'. Make sure that the resource name is spelled correctly.
The error is being caused by the .js files included with the default web forms project. I have those references included within the Toolkitscript manager in the Master Page as can be seen below.
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
<%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=272931&clcid=0x409 --%>
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="jquery.ui.combined" />
<asp:ScriptReference Name="WebForms.js" Path="/Scripts/WebForms/WebForms.js" />
<asp:ScriptReference Name="WebUIValidation.js" Path="/Scripts/WebForms/WebUIValidation.js" />
<asp:ScriptReference Name="MenuStandards.js" Path="/Scripts/WebForms/MenuStandards.js" />
<asp:ScriptReference Name="GridView.js" Path="/Scripts/WebForms/GridView.js" />
<asp:ScriptReference Name="DetailsView.js" Path="/Scripts/WebForms/DetailsView.js" />
<asp:ScriptReference Name="TreeView.js" Path="/Scripts/WebForms/TreeView.js" />
<asp:ScriptReference Name="WebParts.js" Path="/Scripts/WebForms/WebParts.js" />
<asp:ScriptReference Name="Focus.js" Path="/Scripts/WebForms/Focus.js" />
<asp:ScriptReference Name="WebFormsBundle" />
If I comment out those refrences then the error goes away, but I loose all of the formating, animation, and look and feel of the site. I have also tried building those files as an embedded resource, but that made no difference in my issue.
I am at a loss because I can not understand what is different in the build between IIS Express and runing against regular IIS?
I have spent a lot of time trying to figure this out and any helps would be greatly appreciated!
Oct 10, 2013 10:31 AM|jasket|LINK
I sit with the exact same problem and dont know what the cause it hope someone points us in right direction i have looked up any possible soultion on google and not one worked.
Oct 10, 2013 03:37 PM|dean5757|LINK
After several days of reading nearly the entire internet I firgured out what was going on. I never found any posts or sites that specifically addressed the problem, but I pieced things together as I went. I know why the issues happens and how to fix it,
but I still am unclear about why there is a difference between how IIS Express handles this and how regular IIS handles it. So here we go.
As you can see in the error the .js file refrences can not be located within the AjaxControlToolkit.dll file. I am assuming IIS is looking there because the references sit within the ajaxToolKit:ToolkitScriptManager tag. I would think it would think it
would still look within the DLL of the application since that tag is just an extension of the normal scriptManager tag. But that is neither here nor there.
To fix this you need to change your .js files to build as embedded resources and then add them to your projects assembly. Navigate to the .js file within your project and change the "Build Action" property to "Embedded Resource". Do this for each of the
.js files in question. next go to you AssemblyInfo.cs file in the project and add your resources there. See the code below:
Once added there you want to update your ScriptReferences in your Site.Master. You want to reference the .js files within the projects assembly. The name should be the full namespace path as you can see in the code below:
<asp:ScriptReference Assembly="BMSPortalASP" Name="BMSPortalASP.Scripts.WebForms.WebForms.js" />
<asp:ScriptReference Assembly="BMSPortalASP" Name="BMSPortalASP.Scripts.WebForms.WebUIValidation.js" />
<asp:ScriptReference Assembly="BMSPortalASP" Name="BMSPortalASP.Scripts.WebForms.MenuStandards.js" />
<asp:ScriptReference Assembly="BMSPortalASP" Name="BMSPortalASP.Scripts.WebForms.GridView.js" />
<asp:ScriptReference Assembly="BMSPortalASP" Name="BMSPortalASP.Scripts.WebForms.DetailsView.js" />
<asp:ScriptReference Assembly="BMSPortalASP" Name="BMSPortalASP.Scripts.WebForms.TreeView.js" />
<asp:ScriptReference Assembly="BMSPortalASP" Name="BMSPortalASP.Scripts.WebForms.WebParts.js" />
<asp:ScriptReference Assembly="BMSPortalASP" Name="BMSPortalASP.Scripts.WebForms.Focus.js" />
This finally worked for me and I hope it does for you as well. I still don't know the internal difference with IIS vs. IIS Express, but maybe it is a bug or issue that needs to be addressed. All I know is the problem was maddening to me and I am glad to
have it resolved.
Oct 10, 2013 07:56 PM|jats_ptl|LINK
To get the Ajax Control Tool Kit to work on the server
you need copy the DLL from the Ajax Control Tool Kit to a location in the web site on the server.
You then need to either modify the code or web.config to point to the DLL
You have to select the correct "Application Pool" using IIS Manager
you need to chose the "default" to use "Net 4.0" or "Net 2.0"
depending on what code your project uses.
The reason you have it working in "Visual Studio" is you did a method like copy
when you added the Ajax Control Kit to the "Tool Box" and then references to the DLL.
Could you do a test for Ajax Control Kit by un-archiving the zip package from
your download to a place on your system.
Could you look for the sample web site in the un-archived zip folders and when you find that section
use Windows Explorer to copy the whole "sample site" into the IIS Server.
Then using IIS Manager add the "sample site" to your "default" sites
and name the site "samples" mark the samples as an application.
Check that the new site has "IUSR" present and permissions of "Read","Execute",List".
Restart the web Server.
Then after the restart using IIS Manager browse to the samples site on "localhost"
the browse should be http:// localhost / samples / default.aspx ignore the extra spaces they are for better reading.
Hope this helps.
Oct 11, 2013 12:47 AM|chetan.sarode|LINK
Oct 12, 2013 03:40 AM|gcapnias|LINK
If you check your code you have:
<asp:ScriptReference Name="WebFormsBundle" />
This bundle have all the above scripts included, except the jQuery ones - why have them referenced twice? You should remove them...