December 23, 2014

No service for type

Error:
An unhandled exception occurred while processing the request.
Exception: TODO: No service for type 'ABC.Services.XYZService' has been registered.
Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)

Solution:
If you have a new Service in your ASP .Net vNext, you need to add below line in ConfigureServices(IServiceCollection services) function in Startup.cs for register it ;-)

services.AddTransient<XYZService>();

PS: At this time ASP .Net vNext, Visual Studio 2015 and MVC 6.0 are beta version.
Update 1: it could be solved with this services.AddScoped<XYZService>();

November 09, 2014

Problem with webopt for Scripts

Quistions: 
- BundleReference for ASP .Net Forms
- System.Web.Optimization.Scripts.Render for ASP .Net Forms
- Render script without bundlereference
- Microsoft.AspNet.Web.Optimization.WebForms for Render Scripts
- @Scripts.Render for Web Forms
- Render ScriptBundle for Web Forms

Solution:
<%: System.Web.Optimization.Styles.Render("~/bundles/css") %>
<%: System.Web.Optimization.Scripts.Render("~/bundles/js") %>

August 26, 2014

Microsoft.Jet.OLEDB.4.0 provider is not registered

Error:
The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.

Resolution:
There is no chance to use of Microsoft.Jet.OLEDB.4.0 and Microsoft Access Files like mdb file on 64bit Windows

Solution 1:
Right Click on Project > Properties > Build > Change Platform Target to x86 and recompile it again

Solution 2:
Go to App.config and change ConnectionString from Provider=Microsoft.Jet.OLEDB.4.0 to Provider=Microsoft.ACE.OLEDB.12.0

August 22, 2014

The service cannot be activated

Error:
The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the service type with RequirementsMode setting as 'Allowed' or 'Required'.

Solution:
Add this line in top your Service class
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]