Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

ComponentNotFound exception Castle.Windsor -


i trying started castle.windsor , following comment made on samples available newbies (http://stw.castleproject.org/windsor.silvertlight_sample_app_customer_contact_manager.ashx?discuss=1), thought i'd take bull horns , update example provided here http://dotnetslackers.com/articles/designpatterns/inversionofcontrolanddependencyinjectionwithcastlewindsorcontainerpart1.aspx.

this simple , straightforward console application making use of castle windsor, albeit outdated version. main method in program.cs follows:

public static void main()     {         iwindsorcontainer container = new windsorcontainer();          container.install(fromassembly.this());         var retriever = container.resolve<ihtmltitleretriever>();          console.writeline(retriever.gettitle(new uri(configurationmanager.appsettings["fileuri"])));          console.read();          container.dispose();     } 

and service , components, in same file i.e. program.cs thus:

public interface ihtmltitleretriever {     string gettitle(uri file);  }  public interface ifiledownloader {     string download(uri file); }  public interface ititlescraper {     string scrape(string filecontents); }  public class htmltitleretriever: ihtmltitleretriever {     private readonly ifiledownloader _downloader;     private readonly ititlescraper _scraper;      public htmltitleretriever(ifiledownloader dowloader, ititlescraper scraper)     {         _downloader = dowloader;         _scraper = scraper;     }      public string gettitle(uri file)     {         string filecontents = _downloader.download(file);         return _scraper.scrape(filecontents);     } }    public class httpfiledownloader : ifiledownloader {     public string download(uri file)     {         return new webclient().downloadstring(file);     } }  public class stringparsingtitlescraper : ititlescraper {     public string scrape(string filecontents)     {         string title = string.empty;         int openingtagindex = filecontents.indexof("<title>");         int closingtagindex = filecontents.indexof("</title>");          if(openingtagindex != -1 && closingtagindex != -1)             title = filecontents.substring(openingtagindex, closingtagindex - openingtagindex).substring(7);          return title;     } } 

it pretty straight copy of simone busoli has example. code compiles fine following error when run application:

no component supporting service windsorsample.ihtmltitleretriever found

i understand means don't know i'm doing wrong components not getting loaded container. i'm using castle.windsor 2.5.2 , .net 4.0.

looking forward answers,

david

first of - awesome you're updating sample. mentioned, smaller sample, without silverlight overhead useful.

as question - exception means service requested, ihtmltitleretriever not supported component registered, in other words - didn't seem have registered ihtmltitleretriever in container @ all. how installer like? check if components registered can put breakpoint in line after call install , see components registered, , if that's expecting. it's quite useful diagnosing issues 1 you're having. (see documentation here).

if you're still not sure reason is, make sure installer classes public, , post code here can try figure out what's reason.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -