.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Unity container works within Asp.net project but not within class library it calls.

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :ASP.Net

I have a solution with an asp.net project and several class libraries.  I am using Unity 2.0 in all the projects.  Unity 2.0 seems to work within the HelpfulQuiz web asp.net project, but not within the HelpfulQuizCore class library it utilizes.  I've spent several days trying to figure this out and would appreciate your kind assistance.  Here is the error:


Server Error in '/' Application.

The current type, HelpfulQuizCore.Core.IPictureRepository, is an interface and cannot be constructed. Are you missing a type mapping?

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.InvalidOperationException: The current type, HelpfulQuizCore.Core.IPictureRepository, is an interface and cannot be constructed. Are you missing a type mapping?

Source Error: 

Line 30:             containe

View Complete Post

More Related Resource Links

Error on VS 2008 Class Library project: are you missing an assembly reference?)

http://msdn.microsoft.com/en-us/library/bb153523(office.12).aspx Working with ASP.NET 2.0 Web Parts and Windows SharePoint Services 3.0 Based on the above MSDN Walkthrough, I created a Class Library VS 2008 project. When clicking the Build menu, 11 errors on System.Web.Security etc popped up.  What's wrong? *********************************************** using   System; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; Error 1 The type or namespace name 'Security' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) Error 2 The type or namespace name 'UI' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

How to use webservice in Class Library Project


I've created class library project and added service reference to  webservice.
When i try to use webservice object am not able to access webservice methods.

myservice proxy=new myservice();

proxy.( no methods are coming)?

Normal Class library can not be added to silverlight project. why?



I had developed class library (entity framework) and it was used in windows application and working fine.

I am trying to convert windows app to silver light and started coding. but existing class library can not be added to silver light project!!

do I have to re code?



Many Thanks Deepak

Error while using Silverlight class library in .NET 4 Client Profile project


Failed to figure out where to post this problem.

I have two projects in solution: Silverlight 4 assembly and Console application targeted .NET 4 Client Profile. There's an interface in Silverlight assembly which has a return value typed IEnumerable<IPEndPoint>. In console application I'm trying to implement this interface. I have the following error compiling console application project: 'PeerToPeerNameResolver' does not implement interface member 'INameResolver.Resolve(string)'. 'PeerToPeerNameResolver.Resolve(string)' cannot implement 'INameResolver.Resolve(string)' because it does not have the matching return type of 'System.Collections.Generic.IEnumerable<System.Net.IPEndPoint>'

I've never defined my own class IPEndPoint, nor IEnumerable<T> interface. How can I get rid of this error? Method code is 

		public IEnumerable<IPEndPoint> Resolve(string name)
var peername = new PeerName(name, PeerNameType.Unsecured);

Using a GenericHandler as a WebResource inside a Class Library



I hope this is the right place to ask this question.

I'm trying to make a control class library. I want to have a GenericHandler as a WebResource so I could call it from the web project that will use that control.

I need this handler will get parameters from the query string and return JSON data acourding to what it get in the QS.

I know how to create JS and images WebResources, so I tried the same on a generic handler I added to the class library project but all it does is return the source of the handler file and not the result.


Is what I'm trying to do possible? If so, what should I do?


Thank :-)

Localization not working in class library (composite control)



I have a class library called WEM.portal which used Resource files to localise text in my composite controls.

I store my resource files (eg MyResourceFile1.resx) in App_GlobalResources folder and then refer to them using

MyLabel1.text = My.Resources.MyResourceFile1.MyResourceKey1

This is all working ok until I create seperate files for each language such as MyResourceFile1.FR-fr.resx.

I have implemented this throughout my other web applications but the Class Library doesnt seem to want to work the same way

When I load the page it correctly showes the resourced keys which I have done through the web application BUT the resource keys in the composite controls does not seem to pick up the culture code.

Am I missing something stupid. Ive tried

  • changing the Build Action on the resource file to Content and Custom tool to GlobalResourceProxyGenerator
  • Creating a resourceManager but to no avail


CLR Inside Out: What's New in the .NET Framework 4 Base Class Library


Just about everyone who uses Microsoft .NET uses the Base Class Libraries (BCL).When we make the BCL better, almost every managed developer benefits. This column will focus on the new additions to the BCL in .NET 4 beta 1.

Justin Van Patten

MSDN Magazine September 2009

CLR Inside Out: Base Class Library Performance Tips and Tricks


The common language runtime (CLR) sits at the very heart of managed code. Indeed, it is the heart of managed code, so to understand managed code you need to understand the CLR.

Kit George

MSDN Magazine January 2006

Timers: Comparing the Timer Classes in the .NET Framework Class Library


Timers often play an important role in both client applications and server-based components (including Windows services). Writing effective timer-driven managed code requires a clear understanding of program flow and the subtleties of the .NET threading model. The .NET Framework Class Library provides three different timer classes: System.Windows.Forms.Timer, System.Timers.Timer, and System.Threading.Timer. Each of these classes has been designed and optimized for use in different situations. This article examines the three timer classes and helps you gain an understanding of how and when each class should be used.

Alex Calvo

MSDN Magazine February 2004

Serial Comm: Use P/Invoke to Develop a .NET Base Class Library for Serial Device Communications


Out-of-the-box, the only way of coding RS232 serial communications applications in the .NET environment is to import the outdated and somewhat limited MSComm ActiveX control. This article describes the development of a lean, multithreaded, and modern RS232 base class library in C# managed code. The library uses Platform Invocation Services to interact with the Win32 API directly. Application programmers can use the library from any .NET language through inheritance; the article explores examples written in C# and Visual Basic .NET.

John Hind

MSDN Magazine October 2002

Timer usage in a class library

Hi all,     I have a class library, inside a class of this library i want to use a timer, such that for every one second a slot should be called. The code for this is as follows: </>public void OnDataReceive() { System.Windows.Forms.Timer t1 = new System.Windows.Forms.Timer(); t1.Enabled = true; t1.Interval = 500; t1.Start(); t1.Tick += new EventHandler(t1_Tick); }   public void t1_Tick(object sender, EventArgs e) { OnReceive(); }   But it is not reaching to this function itself "t1_Tick", Could some one tell me what is wrong in this??? Thanks for any help

Sequential Workflow project unable to compile referencing x64 Workflow Activity Library

Folks -   I have an sequential workflow project targeting x64 that will not compile if the workflow activity library that it references is compiled for x64 (it will compile if the activity library targets x86).  The compile error I receive is: Compilation failed. Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. [project name]   Any thoughts on how to figure this out?   Thanks.

project using ADO.NET & EF works, but not inside customers network...

I'm developing a case management package called SLPortal and I've run into some rather strange problems. Here's the breakdown: It's a .Net 3.5 web app developed in VS2008 using C#, ADO.NET and Entity Framework. Database is MS SQL Server 2005 hosted on Windows Server 2003 Webserver is IIS6 on Windows Server 2003 It's hosted from within the Boise State University LAN. The test system at my house runs 'fine' in that most everything works as intended, aside from the occasional bug from my inexperienced code. Here's the key issue: It seems like when we (myself and the testers) log into the system from on campus, all 'Create' functions quit working, with one exception: I used the Microsoft asp.net MembershipProvider tables to handle the User and Roles functionality. They are built into the FACULTYINTAKE database. All Create, Update, and Delete functionality for these tables work correctly, but note that I am strictly using the MS provided functions to interact with it. I can use the system from home and off the BSU campus and it works. The test systems run Windows XP Pro sp3, Vista Business x86 (32 bit), and Windows Server 2008 64bit using Internet Explorer 7 and 8, Firefox, Safari 4, and Chrome. There are hiccups, but all the database stuff works. When we attempt to use the system from BSU, anywhere on the BSU

How to get a file path in a class library used by asp.net

 Hello,   I have an asp.net application which employs a class project to process xml files. I have an xsd file within the class project. To load the xsd file, I am not sure which path I should use. The following code snippet loads the xsd, and reads the xsd using the StreamReader. I am not sure how to set the value for xsdPath variable.// 2- Read Schema file content StreamReader SR = new StreamReader(xsdPath); // 3- Create a new instance of XmlSchema object XmlSchema Schema = new XmlSchema(); // 4- Set Schema object by calling XmlSchema.Read() method Schema = XmlSchema.Read(SR, new ValidationEventHandler(ReaderSettings_ValidationEventHandler)); Thanks  

Load Javascript/CSS from C# Class Library

Can anyone help me figure out how to load Javascript/CSS from my Class Library onto my .aspx pages? Is it possible?Thanks

To get the relative path in the class library

Hello, I have to access a relative path of the XSD file to validate a XML file. The XML file and the XSD file are part of the class library. How do I access the relative path in the class library? In case of website, I would use server.mappath(path). Is there anything similar to get the virtual path to the corresponding physical directory on the server in the class library? Thanks

Custom Web Part deployment with class library reference

Hi All, We have class library as a project in our solution as well as a web part project. Our web part simply references and executes a service utility class in the class library and outputs it into a label. The deployment is successful but when attempting to add the web part to the page, it comes out with a error page saying "File Not Found" with a correlation ID and date/time reference. Once we take out the code that executes the utility class, it deploys fine and we're able to add it to the page without any issues. It seems evident that any reference to our class library causes this "File Not Found" issue... but we're not sure how to implement this solution. Any ideas? Do we add the class library dll directly into the GAC?  If so, how? Is there another reference we have to implement in the AssemblyInfo.cs?  If so, what does that look like? Any help is appreciated. Thanks, Eric
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend