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.
Related
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
I'm facing a weird issue with the WIF ClaimsAuthenticationManager. I have registered the custom implementatin of the ClaimsAuthenticationManager in the web.config file:
<identityConfiguration>
<claimsAuthenticationManager type="<namespace>.CustomClaimsTransformer,<assembly>" />
<claimsAuthorizationManager type="<namespace>.CustomAuthorisationManager,<assembly>" />
....
When i run the application in the IISExpress the authenticate method of the ClaimsAuthenticationManager gets invoked. However, it's not being invoked ever since i deployed the application on IIS 7.5.
Is there any configuration that needs to be done?
In the system.webserver part of your web.config do you have the ClaimsAuthorizationModule set,
eg
<add name="ClaimsAuthorizationModule" type="Microsoft.IdentityModel.Web.ClaimsAuthorizationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
For .NET 4.5 you have to add this:
<add name="ClaimsAuthorizationModule" type="System.IdentityModel.Services.ClaimsAuthorizationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
ClaimsAuthenticationManager is not invoked automatically. One needs a plumbing code for that unless they are using WS-Federation.
You can do it in an PostAuthenticateRequest event handler for the HttpApplication.
A good example is located in the http://github.com/thinktecture/Thinktecture.IdentityModel.45 project. Search for ClaimsAuthenticationHttpModule.cs which invokes it.
I created an ASP.NET MVC WebPages application. Works perfectly local. Works perfectly on the server when I install it as a website. However when it is installed as an IIS application (level below another website, using the same application pool) all it does is throwing this exception:
Could not load file or assembly
'System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The system cannot find the file specified.
Apparently something related to WCF RIA services, which is not used. All I use is Linq to SQL. How is this possible?
Server: Windows Server 2008 R2 with IIS 7.5
Check the web.config of your application if it contains an entry like:
<httpModules>
<add name="DomainServiceModule"
type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</httpModules>
It is located in the <system.web> section.
Theres is also another entry like:
<modules runAllManagedModulesForAllRequests="true">
<add name="DomainServiceModule"
preCondition="managedHandler"
type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</modules>
in the <system.webserver> section.
Remove the entries, then you should not get the exception.
I know it too late, but may be my answer will be useful for some people.
I had similar problem, but no corresponded to IIS.
So, I had web app based on RIA services. This app used separate dll (DAL) which contained some classes attributed by RIA attributes (of course, it had reference to RIA dll). The dll (DAL) was referenced by another app which did not use RIA and raised same error as you mentioned (but only with System.ServiceModel.DomainServices.Server).
This error was raised only during WCF channel creation (ChannelFactory<>). So I suppose WCF should know about all referenced dlls during analyzing of attributes of contract's classes. But I did not found any explanation why WCF don't used only own attributes whithout analizing all of them.
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"/>
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!