A Place for C Sharpers/.Netters

I Will do coding till last moment of life-Kiran Patil

Archive for the ‘Web Client Software Factory’ Category

Service XXX.ABCService is not available in the current context.+WCSF

Posted by kiranpatils on March 31, 2008

Problem:

if you have changed your solution structure to one level down means first your page opens up like this: /Employee/Employee.aspx and now you
moved Employee Folder to EMI folder. So now page URL should look like this when it s open: EMI//Employee/Employee.aspx

and it is dependent on its Module named as Employee and now when you run the application the page says:

Service XXX.ABCService is not available in the current context.

Stack Trace:
Service XXX.ABCService is not available in the current context.
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: Microsoft.Practices.CompositeWeb.ServiceMissingException: Service IEmployeeService is not available in the current context.

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.

Stack Trace:

[ServiceMissingException: Service IEmployeeService is not available in the current context.]
Microsoft.Practices.CompositeWeb.Collections.ServiceCollection.Get(Type serviceType, Boolean ensureExists) +291
Microsoft.Practices.CompositeWeb.Collections.ServiceCollection.Get(Type serviceType, Boolean ensureExists) +237
Microsoft.Practices.CompositeWeb.ServiceDependencyParameter.GetValue(IBuilderContext context) +142
Microsoft.Practices.ObjectBuilder.ConstructorPolicy.GetParameters(IBuilderContext context, Type type, String id, ConstructorInfo constructor) +102
Microsoft.Practices.ObjectBuilder.WCSFExtensions.CreationStrategy.InitializeObject(IBuilderContext context, Object existing, String id, ICreationPolicy policy) +117
Microsoft.Practices.ObjectBuilder.WCSFExtensions.CreationStrategy.BuildUpNewObject(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +208
Microsoft.Practices.ObjectBuilder.WCSFExtensions.CreationStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +51
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
Microsoft.Practices.ObjectBuilder.WCSFExtensions.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +322
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
Microsoft.Practices.ObjectBuilder.WCSFExtensions.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +322
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
Microsoft.Practices.ObjectBuilder.WCSFExtensions.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +322
Microsoft.Practices.ObjectBuilder.SingletonStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +171
Microsoft.Practices.ObjectBuilder.TypeMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id) +322
Microsoft.Practices.ObjectBuilder.CreationParameter.GetValue(IBuilderContext context) +31
Microsoft.Practices.ObjectBuilder.ConstructorPolicy.GetParameters(IBuilderContext context, Type type, String id, ConstructorInfo constructor) +102
Microsoft.Practices.ObjectBuilder.WCSFExtensions.CreationStrategy.InitializeObject(IBuilderContext context, Object existing, String id, ICreationPolicy policy) +117
Microsoft.Practices.ObjectBuilder.WCSFExtensions.CreationStrategy.BuildUpNewObject(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +208
Microsoft.Practices.ObjectBuilder.WCSFExtensions.CreationStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +51
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
Microsoft.Practices.ObjectBuilder.WCSFExtensions.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +322
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
Microsoft.Practices.ObjectBuilder.WCSFExtensions.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +322
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
Microsoft.Practices.ObjectBuilder.WCSFExtensions.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +322
Microsoft.Practices.ObjectBuilder.SingletonStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +171
Microsoft.Practices.ObjectBuilder.TypeMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id) +322
Microsoft.Practices.ObjectBuilder.CreationParameter.GetValue(IBuilderContext context) +31
Microsoft.Practices.ObjectBuilder.PropertySetterInfo.GetValue(IBuilderContext context, Type type, String id, PropertyInfo propInfo) +10
Microsoft.Practices.ObjectBuilder.PropertySetterStrategy.InjectProperties(IBuilderContext context, Object obj, String id) +259
Microsoft.Practices.ObjectBuilder.PropertySetterStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +29
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
Microsoft.Practices.ObjectBuilder.WCSFExtensions.CreationStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +68
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
Microsoft.Practices.ObjectBuilder.WCSFExtensions.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +322
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
Microsoft.Practices.ObjectBuilder.WCSFExtensions.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +322
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +38
Microsoft.Practices.ObjectBuilder.WCSFExtensions.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +322
Microsoft.Practices.ObjectBuilder.SingletonStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild) +171
Microsoft.Practices.ObjectBuilder.TypeMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id) +322
Microsoft.Practices.ObjectBuilder.WCSFExtensions.WCSFBuilderBase`1.BuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies) +151
Microsoft.Practices.CompositeWeb.CompositionContainer.BuildItem(IBuilder`1 builder, IReadWriteLocator locator, Object item) +256
Microsoft.Practices.CompositeWeb.WebClientApplication.InnerPreRequestHandlerExecute(IHttpContext context) +92
Microsoft.Practices.CompositeWeb.WebClientApplication.Application_PreRequestHandlerExecute(Object sender, EventArgs e) +79
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

Solution:
In web. config under that folder means /DevelopmentWebsite/EMI/Employee/Web.config
and locate modules section under it
you will have like this:
<module name=”Employee” assemblyName=”Employee” virtualPath=”~/Employee”> //old configuration

change it to like this
<module name=”Employee” assemblyName=”Employee” virtualPath=”~/EMI/Employee”> //new configuration


That’s it!!
Why it happened?


for it you should understand Web.config file.
Web.config file. This is an ASP.NET configuration file that contains the module definition. The module definition is a <module> entry inside the <modules> configuration section of the Composite Web Application Block. A module definition has the following elements:
name attribute. This is the name of the module. for example Employee
assemblyName attribute. This is the name of the module assembly.for example Employee
virtualPath attribute. This is the relative path where the Web pages of the module are located within the Web site. Business modules must always declare the attribute. Foundational modules must not declare the attribute. for example ~/EMI/Employee
<dependencies> element. This defines inter-module dependencies. A module can express dependencies on other modules by adding <dependency> entries inside the <dependencies> element. All modules listed as dependencies will be loaded before the current module is loaded.

This may be occur for others too..main problem is modules section and in web.config.

UPDATED 23-APR-2008

I had faced the same error before few days.. and found one more cause for this error.

If you have not register your service under XYZModuleInitializer.cs file’s method

protected virtual void AddModuleServices(IServiceCollection moduleServices)

{

//REGISTER YOUR SERVICE HERE.

}

Then it will also give you same error..so register your service first and kill that error.

Posted in Web Client Software Factory | Tagged: | 1 Comment »

Why ObjectContainerDataSource?+WCSF

Posted by kiranpatils on February 29, 2008

Why ObjectContainerDataSource?

–> for strictrly following MVP.

–> Why not we use ObjectDataSource or SqlDataSource?
ObjectDataSource = it binds up with Custom object or Business entiy some where in Middle tier. which we don’ want.
SqlDataSource = when you do onSelecting,OnInserting,OnUpdating etc. events it fires to sql server.

–>where our Hero-ObjectContainerDataSource fires the event OnSelecting,OnInserting,OnUpdating event on thise event a page can
register a Presnter method here for the operations.

That’ why we use ObjectContainerDataSource..

if Some one has more views to share pls do it

Posted in Web Client Software Factory | Leave a Comment »

ASP.NET TEMP ERROR While Building+WCSF/General ASP.NET

Posted by kiranpatils on February 8, 2008

from last few days when we are implementing WCSF. we are facing some errors which are really not ours..it is of TEMP files generated by ASP.NET.

Problem:

Suppose i have one Interface named as IEmployee and it has 3 members EmpName,EmpID,EmpAddress and one of my page let’s say Employee.aspx implements it so it looks like this:

Employee.aspx:IEmployee

{

//Three Members implemented

}

now i build and it shows “Build Succeeded” .

after sometime i think that i don’t need “EmpID” in interface so i delete it and also deleted its implementation from Employee.aspx and now when i Build it. it shows me error and when i click on it it points to me ASP.NET Temp files location. which are not mine. [For your knowledge i want to say that ASP.NET Generates Temporary files at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\<Web site name>]. so it will point you there. But as i think it should work fine……..for that i have to work around it for hours and hours..so want to know its solution???

Stack Trace:

Error:
Error 126 ‘Employeet’ does not implement interface member ‘IEmployee.EmployeeID’ c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\developmentwebsitea97a19d\326f353\App_Web_euqzzc2o.0.cs 14

Solution:

For solving this error just follow me:

1.Take Copy/Backup of Employee.aspx page.

2.Now Delete if from WebSite Solution.
3.Now Build Solution. [you will not found that error]

4. Now add that page again from Backup path.

5. Now Build it and That’s it…..You have killed the errors successfully.

Enjoy ASP.NET!!

-Kiran Patil

Posted in ASP.NET, Web Client Software Factory | Tagged: | 2 Comments »