Monday, March 26, 2012

Problem - Adding AJAX ddls as a reference rather than GAC (.msi) install

I have spent a lot of time reading these forums and realize that this is a very hot question right now. I fall into the plethora of people who's web host does not install the AJAX.msi...

After reading for a while I have come across multiple posts that stated that they have simply added the dll's as a reference and got their site running without even having to touch the GAC. Despite this, people still seem to be having troubles (including me) doing this and there also seems to be a bit of a dispute as to teh disadvantages to this approach (especiall the trust factor).

Can someone, who has successfully added these as a refernce and not via the GAC, do a quick walkthrough for the rest of us? I have added them, but cannot get AJAX controls to function (it complies fine without erros, but they do not "activiate" or anything while I am debugging). If someone could do a detailed walkthrough, I think it will not only help many out, but it will also make AJAX avalible to many many other people.

Finally, if anyone can comment on the disadvantages of this, that would be great as well. Hopefully, we can get this all in one place so that everyone will have a nice reference. Thanks!

Nathan

With each version of Atlas and then the most recent releases of Ajax and the Toolkit I did exactly what you are asking about each time, successfully.

There are only two requirements, other than the actual code in your Ajax enabled pages.

1) Your applications /bin/ folder much contain the correct DLLs.

2) Your applications web.config must contain the correct information about the build versions in your apps /bin/ folder.

The easiest way for me to make the changes each time has been to use the sample Ajax web.config provided to modify my own apps web.config


Thanks for the reply!j

I guess my problem is stemming from the web.config then. i am attempting to customize it to fit my build... I know very little about it. To honest, i am not fluent enough to determine which parts are needed specifically. Can you post the changes you made in order to adapt it to "point" to your bin directory? Thanks!


No problem.

This is a working web.config for each of the current versions:

-------------

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<connectionStrings>
<clear />
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=server;Initial Catalog=database;User ID=user;Password=password;" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.net>
<mailSettings>
<smtp>
<network host="localhost" port="25"/>
</smtp>
</mailSettings>
</system.net>
<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add tagPrefix="asp" namespace="Microsoft.Web.Preview.UI" assembly="Microsoft.Web.Preview"/>
<add tagPrefix="asp" namespace="Microsoft.Web.Preview.UI.Controls" assembly="Microsoft.Web.Preview"/>
</controls>
<tagMapping>
<add tagType="System.Web.UI.WebControls.CompareValidator" mappedTagType="Sample.Web.UI.Compatibility.CompareValidator, Validators, Version=1.0.0.0"/>
<add tagType="System.Web.UI.WebControls.CustomValidator" mappedTagType="Sample.Web.UI.Compatibility.CustomValidator, Validators, Version=1.0.0.0"/>
<add tagType="System.Web.UI.WebControls.RangeValidator" mappedTagType="Sample.Web.UI.Compatibility.RangeValidator, Validators, Version=1.0.0.0"/>
<add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="Sample.Web.UI.Compatibility.RegularExpressionValidator, Validators, Version=1.0.0.0"/>
<add tagType="System.Web.UI.WebControls.RequiredFieldValidator" mappedTagType="Sample.Web.UI.Compatibility.RequiredFieldValidator, Validators, Version=1.0.0.0"/>
<add tagType="System.Web.UI.WebControls.ValidationSummary" mappedTagType="Sample.Web.UI.Compatibility.ValidationSummary, Validators, Version=1.0.0.0"/>
</tagMapping>
</pages>
<compilation debug="false">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
<buildProviders>
<add extension="*.asbx" type="Microsoft.Web.Preview.Services.BridgeBuildProvider"/>
</buildProviders>
</compilation>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
<add verb="GET,HEAD,POST" path="*.asbx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-ISAPI-2.0"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" verb="GET" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ASBXHandler" verb="GET,HEAD,POST" path="*.asbx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</handlers>
</system.webServer>
</configuration>
--------------------------


I appreciate the assitance there, but I am still having no luck. I have spoken with a few others who are encoutering the same errors as I am. They stated that this is a trust issue set by my host rather than a configuration issue that I am having...<trust level="Medium"/>

I am at a loss of what else to try other than to hope that my host comes to their senses... Thanks! If you have any other ideas, please let me konw. thanks!


I'd still like to help you overcome this, can you mention the host so some of us might look into this for you?

I've seen reports of some hosts not allowing full trust but still wonder why...

By the way, what happens if you remove the trust level or set it to "full"?


Hey! I really appreciate you will to help me with this! You rock!

Anyway, I host with godaddy.com. What kills me is that their hosting plan is insanely awesome / cheap, but they are lacking in this, :( ... I have called them and asked if they have / were planning to install the AJAX updates. They said that they had no plans to do so.

If I remove the trust level or raise it to full, I get the same error that I was speaking of (I will post it in the next post).

If you would like, I would be more than happy to open up a temp user / pwd on my account and let you tinker with it via ftp, if you would feel comfortable doing so.

Thanks again!


My good ol' error...

Server Error in '/' Application.


Attempt to access the method failed.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.MethodAccessException: Attempt to access the method failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


I don't deal with godaddy at all but suggest you ask them if an Ajax installation might be an option for you if you use their Metropolis addon.

https://www.godaddy.com/gdshop/hosting/shared.asp?ci=260

You might also want to mention to them that many of the Starter Kits they offer may soon include Ajax, which I'm sure they already know.

I can't suggest any ASP.NET host to match those unbelievably low prices but can suggest a very good host with the works,http://www.DiscountASP.net


I have read that if the trust level is not set to full, then the dlls need to be in the GAC,
or AJAX simply won't work.

This is by design,

Yours
Andreas Knudsen

Okay,

I am goign to speak with Godaddy in the morning. hopefully we can work something out. I appreciate all the feedback. I will post my results. Thanks!


I too have this problem with my host, What are the disadvantages of your host running full trust?

Hi,

Any luck with godaddy? I am also using their hosting and having the same problem. So, to solve a problem I am temporary using Atlas AJAX July build. But it is kind of slow. So, I am planning to switch to another hosting company.


I've done the same thing but I get a different kind of error:

Description:Anerror occurred during the processing of a configuration file requiredto service this request. Please review the specific error details belowand modify your configuration file appropriately.

Parser Error Message:Couldnot load file or assembly 'System.Web.Extensions, Version=1.0.61025.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of itsdependencies. The module was expected to contain an assembly manifest.

Source Error:

Line 45: <assemblies>
Line 46:
Line 47: <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
Line 48: <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
Line 49: <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Can someone help me out pls!! Im dying to see my AJAX site in action!


Your assembly information is correct.

Who is the Host? Are they allowing Full trust? (Application's bin folder)

Have you tried placing the Ajax DLLs in your apps /bin/ folder?
(Look for these in: C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025\)

No comments:

Post a Comment