What is the advantage of add assembly in the web.config
add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
aganist adding assembly to the reference
Any help is appreciated.
TIA
Here's a previous Stack Overflow question answering this (Web site vs Web App):
What is difference between web.config assemblies element and project file Reference element
Related
I am migrating a web application (WebForms) from ASP.NET 3.5 on IIS6 to ASP.NET 4.0 on IIS 7.5.
I created a new project in VS2010 and add the existing source files from the old project and compiled. It took a small amount of tweaking but everything compiled fine.
When I run the application via IIS (http://localhost/myapp) I get the following error:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
The relevant part of the Web.config is:
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
...
The error is highlighting the script ResourceHandler
I have done some Googling but cannot find a solution to this problem. Any ideas?
The first thing that pops out at me is that the ScriptResourceHandler block, as well as the others that you've listed, are referencing v3.5 of System.Web.Extensions, where it should be referencing v4 for a .NET 4 application.
(Not all of the .NET 4 framework assemblies have been updated to a v4 version number but this one does.)
It looks like you're working with the the old v3.5 web.config. If so, you may try making a backup of web.config (of course), adding a new, default web.config to the web app, and then adding in any custom settings (appSettings, connectionStrings, etc). That's probably the fastest way to get a correct web.config without having to manually modify each entry, update attribute names, etc.
Also, you may or may not be aware that many IIS settings have been moved into the system.webServer section in web.config in 7.x that were in other sections for IIS6/v3.5. If you start with VS's default v4 web.config, it won't be an issue.
Ive managed to get asp.net mvc up and running on an iis6 server, but I keep getting silly messages like 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'RenderPartial'
I've got all the required dlls and even installed mvc from
http://www.microsoft.com/downloads/details.aspx?FamilyID=c9ba1fe1-3ba8-439a-9e21-def90a8615a9&displaylang=en
any clues about what Im missing?
Cheers
RenderPartial is an extension method and is defined in System.Web.Mvc.
So check out if you have in root Web.config lines adding System.Web.Extensions assembly:
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
in <configuration> <system.web> <compilation> <assemblies> node.
Thanks all for your suggestions and also more importantly for your contributions which has made this site the great site. I dont know what I would do without this site and you guys. Thanks
this link fixed it, replacing the compilers section of the web config did it 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'RenderPartial' - ASP.Net MVC
You are most probably missing this from your web.config:
<add namespace="System.Web.Mvc.Html"/>
I recently started learning about HttpModules and made my first one. I was wondering if someone could explain why some modules in the the web.config include a lot of extra info and others do not.
example: not much info
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
example a lot of info
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
What is a publickeytoken, version, culture. Do I need to do anything special to use those?
Thanks!
These are part of the assembly's fully qualified name.
Version should be self-explanatory.
Culture is the culture that the assembly was compiled for.
PublicKeyToken is a value that is cryptographically derived from the key used to sign the assembly, or (null) if the assembly is unsigned.
For more information, see here.
I am using ASP.NET v3.5 and Visual Studio 2008. For some reason ListView doesn't appear in my toolbox, it doesn't show up in intellisense when coding, and if I try to include one anyways I can't access it from code behind (will give error saying it isn't declared). What am I missing here.... where is my listview!?
Update: I have v3.5 installed but for some reason the project is using 2.0... now on to figure out how to change that. In my project references several things say version 3.5.0.0 and several say 2.0.0.0 .... is there any way to update everything to version 3.5 ???
Try changing your project's TargetFramework to 2.0 and follow VS.NET's instructions to reload project. Then change the TargetFramework back to 3.5 and follow instructions.
It worked for me to get the asp:ListView back into intellisense.
Not sure what gets VS.NET in this state though.
Does your project reference System.Web.Extensions? You will need to do so to get at the new ListView control.
Make sure you have a FQ assembly reference to the 3.5 version of System.Web.Extensions, in the web.config section.
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Also make sure you have a FQ assembly reference in the <system.web><compilation><assemblies> web.config section too.
Imagine the following solution:
Website ABC.com (not Web Application)
BLL (business logic layer in a seperate assembly)
DTO (dto objects in their own assembly)
DAL (data access layer in it's own assembly as well).
The BLL has a reference to the DAL.
The BLL has a reference to the DTO layer.
The Website project references the BLL.
When one compiles the website project, the following DLLs will appear in the BIN directory:
BLL.dll
DTO.dll
DAL.dll
When one goes to preview the site, an error occurs about not having the necessary assembly references... Now if one right clicks on the website project, Add Reference, and explicitly add the reference to the missing assemblies, it will work fine.
It seems to me like ASP.NET pulls the referenced assemblies of the referenced assembly being added/referenced in the website.
Why does one need to add explicit references to the references of the references... ? Sorry if I'm not wording this correctly or if it confusing.
I think the problem may have to do with using a web site project, as oppossed to a Web Application. I can't remember off the top of my head, but there's something funky about the way web site projects are compiled, as oppossed to web application projects.
Here is a good article on your question Compilation and Deployment.
It has something to do with "WebSites" being compile at runtime. Hopefully the above article will answer your question.
Just tested this scenario today for the project I'm on. You should be just fine just adding your assembly in Web.config as:
<compilation debug="true">
<assemblies>
<clear/>
<add assembly="mscorlib"/>
<add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add assembly="YourBLLLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</assemblies>
</compilation>
Also your assemblies should stay in the famous ./bin folder of your web site's root.
GL!