I'm trying to implement the NHibernate session management/repository pattern code found here related to the implementation I originally read on the NHibernate Forge page about effective session management.
I am using ASP.NET Web API 2 and am having issues with the HTTPModule events. When I run the app with a simple Home/Index action, I get a System.Collections.Generic.KeyNotFoundException error in the UnBind method.
When I debug, BeginRequest is never called, and somehow EndRequest is falling through. I believe this is where the error is coming from.
Am I missing something obvious? Why is EndRequest being called before anything else?
LazySessionContext and HTTPModule:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NHibernate;
using NHibernate.Context;
using NHibernate.Engine;
namespace MyService.Service.Infrastructure.SessionManagement
{
//Is up to you to:
//-set the currentsessioncontextclass in nhibernate as follows:
// configuration.Properties[Environment.CurrentSessionContextClass]
// = typeof (LazySessionContext).AssemblyQualifiedName;
//-implement ISessionFactoryProvider or use Castle Typed Factories:
// container.Register(Component.For<ISessionFactoryProvider>().AsFactory());
//-load the SessionFactoryProvider in the HttpApplication as follows:
// HttpContext.Current.Application[SessionFactoryProvider.Key]
// = your instance of ISessionFactoryProvider;
//-inject ISessionFactory in Daos and use GetCurrentSessionContext()
public class LazySessionContext : ICurrentSessionContext
{
private readonly ISessionFactoryImplementor factory;
private const string CurrentSessionContextKey = "NHibernateCurrentSession";
public LazySessionContext(ISessionFactoryImplementor factory)
{
this.factory = factory;
}
/// <summary>
/// Retrieve the current session for the session factory.
/// </summary>
/// <returns></returns>
public ISession CurrentSession()
{
Lazy<ISession> initializer;
var currentSessionFactoryMap = GetCurrentFactoryMap();
if (currentSessionFactoryMap == null ||
!currentSessionFactoryMap.TryGetValue(factory, out initializer))
{
return null;
}
return initializer.Value;
}
/// <summary>
/// Bind a new sessionInitializer to the context of the sessionFactory.
/// </summary>
/// <param name="sessionInitializer"></param>
/// <param name="sessionFactory"></param>
public static void Bind(Lazy<ISession> sessionInitializer, ISessionFactory sessionFactory)
{
var map = GetCurrentFactoryMap();
map[sessionFactory] = sessionInitializer;
}
/// <summary>
/// Unbind the current session of the session factory.
/// </summary>
/// <param name="sessionFactory"></param>
/// <returns></returns>
public static ISession UnBind(ISessionFactory sessionFactory)
{
var map = GetCurrentFactoryMap();
var sessionInitializer = map[sessionFactory];
map[sessionFactory] = null;
if (sessionInitializer == null || !sessionInitializer.IsValueCreated) return null;
return sessionInitializer.Value;
}
/// <summary>
/// Provides the CurrentMap of SessionFactories.
/// If there is no map create/store and return a new one.
/// </summary>
/// <returns></returns>
private static IDictionary<ISessionFactory, Lazy<ISession>> GetCurrentFactoryMap()
{
var currentFactoryMap = (IDictionary<ISessionFactory, Lazy<ISession>>)
HttpContext.Current.Items[CurrentSessionContextKey];
if (currentFactoryMap == null)
{
currentFactoryMap = new Dictionary<ISessionFactory, Lazy<ISession>>();
HttpContext.Current.Items[CurrentSessionContextKey] = currentFactoryMap;
}
return currentFactoryMap;
}
}
public interface ISessionFactoryProvider
{
IEnumerable<ISessionFactory> GetSessionFactories();
}
public class SessionFactoryProvider
{
public const string Key = "NHibernateSessionFactoryProvider";
}
public class NHibernateSessionModule : IHttpModule
{
private HttpApplication app;
public void Init(HttpApplication context)
{
app = context;
context.BeginRequest += ContextBeginRequest;
context.EndRequest += ContextEndRequest;
context.Error += ContextError;
}
private void ContextBeginRequest(object sender, EventArgs e)
{
var sfp = (ISessionFactoryProvider)app.Context.Application[SessionFactoryProvider.Key];
foreach (var sf in sfp.GetSessionFactories())
{
var localFactory = sf;
LazySessionContext.Bind(
new Lazy<ISession>(() => BeginSession(localFactory)),
sf);
}
}
private static ISession BeginSession(ISessionFactory sf)
{
var session = sf.OpenSession();
session.BeginTransaction();
return session;
}
private void ContextEndRequest(object sender, EventArgs e)
{
var sfp = (ISessionFactoryProvider)app.Context.Application[SessionFactoryProvider.Key];
var sessionsToEnd = sfp.GetSessionFactories()
.Select(LazySessionContext.UnBind)
.Where(session => session != null);
foreach (var session in sessionsToEnd)
{
EndSession(session);
}
}
private void ContextError(object sender, EventArgs e)
{
var sfp = (ISessionFactoryProvider)app.Context.Application[SessionFactoryProvider.Key];
var sessionstoAbort = sfp.GetSessionFactories()
.Select(LazySessionContext.UnBind)
.Where(session => session != null);
foreach (var session in sessionstoAbort)
{
EndSession(session, true);
}
}
private static void EndSession(ISession session, bool abort = false)
{
if (session.Transaction != null && session.Transaction.IsActive)
{
if (abort)
{
session.Transaction.Rollback();
}
else
{
session.Transaction.Commit();
}
}
session.Dispose();
}
public void Dispose()
{
app.BeginRequest -= ContextBeginRequest;
app.EndRequest -= ContextEndRequest;
app.Error -= ContextError;
}
}
}
Web.config with HttpModule registered:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<httpModules>
<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
<add name="SessionPerRequest" type="MyService.Service.Infrastructure.SessionManagement.NHibernateSessionModule, MyService.Service" />
</httpModules>
</system.web>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<modules runAllManagedModulesForAllRequests="true">
<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
<add name="SessionPerRequest" type="MyService.Service.Infrastructure.SessionManagement.NHibernateSessionModule, MyService.Service" />
</modules>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Turns out I only needed to register the HttpModules in the system.webServer node and not system.Web.
Related
I have WCF service class 'MusicServiceManager' with the constructor that takes the parameter of IAppAmbientState. I need to pass parameter value to MusicServiceManager constructor at time initializing Service Host. I don't want singleton implementation for IAppAmbientState.
Service Contract
[ServiceContract]
public interface IAlbumService
{
[OperationContract]
string TestMessage();
[OperationContract]
IEnumerable<AlbumData> GetAlbums();
[OperationContract(Name = "GetAlbumByID")]
AlbumData GetAlbum(Guid ID);
[OperationContract(Name = "GetAlbumByName")]
AlbumData GetAlbum(string name);
}
AppAmbientState
public class AppAmbientState : IAppAmbientState
{
public IContainer ServiceContainer { get; }
public AppAmbientState(
IContainer container // autofac DIC container
)
{
ServiceContainer = container;
}
}
MusicServiceManager
public class MusicServicesManager : IAlbumService
{
private readonly IAppAmbientState _appAmbientState;
public MusicServicesManager(IAppAmbientState appAmbientState)
{
this._appAmbientState= appAmbientState;
}
public AlbumData GetAlbum(Guid ID)
{
throw new NotImplementedException();
}
Service Host Configuration Class
public class ServiceHostConfiguration : IServiceHostConfiguration
{
private readonly ServiceHost hostMusicServiceManager;
public ServiceHostConfiguration()
{
var container = ContainerConfiguration.Configure();
AppAmbientState AppAmbientStateInstance = new AppAmbientState(container);
// need help here... MusicServiceManager(AppAmbientStateInstance)????
// ideally I don't want to define my base address in class
this.hostMusicServiceManager = new ServiceHost(typeof(MusicServicesManager));
}
public void InitializeService()
{
try
{
this.hostMusicServiceManager.Open();
Console.WriteLine("App Web Services Started. Press [Enter] To Exit ");
}
catch(Exception exp)
{
Console.WriteLine("App Web Services Could Not Start:: ", exp);
}
}
public void CloseService()
{
this.hostMusicServiceManager.Close();
}
}
Autofac DI Container
public static class ContainerConfiguration
{
public static IContainer Configure()
{
var builder = new ContainerBuilder();
//Application Configuration
builder.RegisterType<Application>().As<IApplication>();
builder.RegisterType<ServiceHostConfiguration>().As<IServiceHostConfiguration>();
builder.RegisterType<AppAmbientState>().As<IAppAmbientState>();
builder.RegisterType<MusicServicesManager>().As<IAlbumService>();
Here is my Demo:
This is the project directory:
Program.cs:
using Autofac;
using Autofac.Integration.Wcf;
using System;
using System.ServiceModel;
using System.ServiceModel.Description;
namespace AutofacTest
{
class Program
{
static void Main(string[] args)
{
ContainerBuilder builder = new ContainerBuilder();
builder.RegisterType<Logger>().As<ILogger>();
builder.RegisterType<Service>();
using (IContainer container = builder.Build())
{
ServiceHost host = new ServiceHost(typeof(Service));
host.AddDependencyInjectionBehavior<Service>(container);
host.Open();
Console.WriteLine("The host has been opened.");
Console.ReadLine();
host.Close();
}
}
}
[ServiceContract]
public interface IService
{
[OperationContract]
string Test();
}
public interface ILogger
{
}
public class Service : IService
{
private readonly ILogger logger;
public Service(ILogger logger)
{
this.logger = logger;
}
public string Test()
{
return "TEst1";
}
}
public class Logger : ILogger
{
}
}
App.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<system.serviceModel>
<services>
<service name="AutofacTest.Service">
<endpoint address="" binding="basicHttpBinding" contract="AutofacTest.IService" name="TestServiceEndPoint" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" name="TestServiceMexEndPoint" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/TestService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Feel free to let me know if the problem persists.
I've wrote a Custom Role Provider :
public class CustomRoleProvider : RoleProvider
{
public override string[] GetRolesForUser(string username)
{
var rolesService = ObjectFactory.GetInstance<IRoleService>();
return rolesService.GetRolesForUser(username.ToInt());
}
public override bool IsUserInRole(string username, string roleName)
{
var rolesService = ObjectFactory.GetInstance<IRoleService>();
return rolesService.IsUserInRole(username.ToInt(), roleName);
}
//....
}
and registered in web.config :
<roleManager enabled="true" defaultProvider="CustomRoleProvider">
<providers>
<clear/>
<add name="CustomRoleProvider"
type="PooyanTKD.Web.Infrastructure.CustomRoleProvider"
connectionStringName="DefaultConnection"
enablePasswordRetrieval="false" enablePasswordReset="true"
requiresQuestionAndAnswer="false" writeExceptionsToEventLog="false" />
</providers>
</roleManager>
And I've wrote a Custom Authorize Attribute :
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public class SiteAuthorizeAttribute : AuthorizeAttribute
{
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
{
if (filterContext.HttpContext.Request.IsAuthenticated)
{
throw new UnauthorizedAccessException(); //to avoid multiple redirects
}
else
{
base.HandleUnauthorizedRequest(filterContext);
}
}
}
but when I decorate my Controller or action method with [SiteAuthorize(Roles="Admins")] after login I'm getting this error :
Attempted to perform an unauthorized operation.
Source Error :
Line 14: if (filterContext.HttpContext.Request.IsAuthenticated)
Line 15: {
Line 16: throw new UnauthorizedAccessException(); //to avoid multiple redirects
Line 17: }
Line 18: else
I've trouble finding out my problem and screwed me up, can anyone help me to figure out where is my problem?
PS : when I check value of User.Identity.Name in other view it's 0, also I check my authentication type in web.config :
<forms name="Sir1Afifi2013"
cookieless="UseCookies"
loginUrl="~/Account/LogOn"
defaultUrl="~/Admin/Main"
slidingExpiration="true"
protection="All"
path="/"
timeout="20" />
</authentication>
Thanks in Advance
finally I solved my problem using redirecting Unauthorized user to another route this way :
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
{
if (filterContext.HttpContext.Request.IsAuthenticated)
{
filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new
{
action = "Index",
controller = "Home",
area = ""
}));
}
else
{
base.HandleUnauthorizedRequest(filterContext);
}
}
I am using ServiceStack for the first time on a brand-new project that started off as a ASP.NET MVC. I am hosting ServiceStack API at the root, so my web.config looks like this:
<system.web>
<httpHandlers>
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
</handlers>
</system.webServer>
and my App_Start/RouteConfig.cs:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("*");
}
Here's my service:
[Route("/catalogs/{ID}")]
[DataContract]
public class CatalogRequest : IReturn<Catalog>
{
[DataMember]
public int ID { get; set; }
}
[DefaultView("Catalogs")]
public class CatalogService : Service
{
public object Get(CatalogRequest request)
{
return (request.ID == 9999) ? new Catalog() { ID = 9999 } : null;
}
}
I use the following for testing:
public class TestAppHost : AppHostHttpListenerBase
{
public TestAppHost() : base("TestService", typeof(TestAppHost).Assembly) { }
public override void Configure(Funq.Container container)
{
IoC.Configure(container); // IoC is where all Funq configuration is done
}
}
In my VisualStudio unit test I start up the AppHost like this:
[TestClass]
public class TestHelper
{
public const string TEST_HOST_URL = "http://127.0.0.1:8888/";
private static TestAppHost __AppHost;
[AssemblyInitialize]
public static void Initialize(TestContext context)
{
// Start the test app host.
__AppHost = new TestAppHost();
__AppHost.Init();
__AppHost.Start(TEST_HOST_URL);
}
[AssemblyCleanup]
public static void Cleanup()
{
__AppHost.Dispose();
__AppHost = null;
}
}
When I run my test:
[TestMethod]
public void RequestCatalogByID()
{
var client = new JsonServiceClient(TestHelper.TEST_HOST_URL);
var request = new CatalogRequest() { ID = 9999 };
var response = client.Get(request);
Assert.IsNotNull(response);
}
I get a "Not Found" exception even though the URL seems to be correct: http://127.0.0.1:8888/catalogs/9999.
Pointing the browser to http://127.0.0.1:8888/metadata shows the metadata page with no operations.
What am I doing wrong?
Note the assembly you pass in your AppHost Base constructor should be where all your service implementations are (i.e. not your AppHost), so try instead:
public class TestAppHost : AppHostHttpListenerBase
{
public TestAppHost() : base("TestService", typeof(CatalogService).Assembly){}
...
}
My event handlers are not auto-subscribing. I'm using NServiceBus-CI 3.0.2044. I had the same issue with NServiceBus-CI 3.0.2027.
<MsmqTransportConfig ErrorQueue="dwh.projectmanagement.documents.notifications.error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig ForwardReceivedMessagesTo="dwh.admin.auditor">
<MessageEndpointMappings>
<add Messages="DWH.Login.EmployeeLoggedInToTIPS, DWH.Events" Endpoint="dwh.webeventpublisher" />
<add Messages="DWH.Login.BuyerLoggedIn, DWH.Events" Endpoint="dwh.webeventpublisher" />
<add Messages="DWH.ProjectManagement.Events" Endpoint="dwh.projectmanagement.commandhandlers" />
<add Messages="DWH.ProjectManagement.Documents.DocumentDistributor.Events" Endpoint="dwh.projectmanagement.documents.documentdistributor" />
</MessageEndpointMappings>
</UnicastBusConfig>
class EndpointConfig : IConfigureThisEndpoint, AsA_Server , IWantCustomInitialization
{
public void Init()
{
log4net.Config.XmlConfigurator.Configure();
var kernel = new StandardKernel();
Configure.With()
.NinjectBuilder(kernel)
.CustomJsonSerializer();
.MsmqTransport()
.IsTransactional(true)
.UnicastBus()
.LoadMessageHandlers()
.CreateBus()
.Start();
// Other DI bindings
}
}
DocumentVersionSignedByBuyer is in the DWH.ProjectManagement.Events assembly.
public class SalesConsultantNotification :
IHandleMessages<DocumentVersionSignedByBuyer>
{
public IBus Bus { get; set; }
private readonly ISalesQueries _salesQueries;
public SalesConsultantNotification(ISalesQueries salesQueries)
{
_salesQueries = salesQueries;
}
public void Handle(DocumentVersionSignedByBuyer message)
{
var salesConsultants = _salesQueries.GetSalesConsultants(message.SaleId);
foreach (var salesConsultant in salesConsultants)
{
var cmd = new NotifySalesConsultantBuyerSigned(salesConsultant, message);
Bus.Send(cmd);
}
}
}
I am using MVVM pattern for Silverlight.
I have these projects:
MVVMDemo.Data (Ria services link set to MVVMDemo.Data.Web)
MVVMDemo.Data.Web (Contains all RIA services) MVVMDemo.Data.ViewModels
MVVMDemo.Data.Models MVVMDemo (contains all views)
MVVMDemo.Data.Common (contains all interfaces)
This is my RIA services class:
namespace MVVMDemo.Data.Web
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Linq;
using System.ServiceModel.DomainServices.EntityFramework;
using System.ServiceModel.DomainServices.Hosting;
using System.ServiceModel.DomainServices.Server;
[EnableClientAccess()]
public class UserServices : LinqToEntitiesDomainService<IssueVisionEntities>
{
public IQueryable<User> GetUsersByLimit(int skip , int take)
{
return this.ObjectContext.Users.Skip(skip).Take(take);
}
public IQueryable<User> GetUsers()
{
return this.ObjectContext.Users;
}
public void InsertUser(User user)
{
if ((user.EntityState != EntityState.Detached))
{
this.ObjectContext.ObjectStateManager.ChangeObjectState(user, EntityState.Added);
}
else
{
this.ObjectContext.Users.AddObject(user);
}
}
public void UpdateUser(User currentUser)
{
this.ObjectContext.Users.AttachAsModified(currentUser, this.ChangeSet.GetOriginal(currentUser));
}
public void DeleteUser(User user)
{
if ((user.EntityState == EntityState.Detached))
{
this.ObjectContext.Users.Attach(user);
}
this.ObjectContext.Users.DeleteObject(user);
}
}
}
This is my model which calls RIA services :-
namespace MVVMDemo.Models
{
[Export(typeof(IUserModel))]
public class UserModel : IUserModel
{
private const int PAGESIZE = 10;
private int skip = 0;
private UserServices _context;
private UserServices Context
{
get
{
if (_context == null)
{
_context = new UserServices();
}
return _context;
}
}
public void GetAllUsersAysnc()
{
PerformQuery<User>(Context.GetUsersQuery(), GetAllUsersAsyncComplete);
}
private void PerformQuery<T>(EntityQuery<T> query , EventHandler<EntityResultArgs<T>> eventHandler) where T:Entity
{
this.Context.Load<T>(query, LoadBehavior.RefreshCurrent, r =>
{
if (eventHandler != null)
{
try
{
if (r.HasError)
{
eventHandler(this, new EntityResultArgs<T>(r.Error));
r.MarkErrorAsHandled();
}
else
eventHandler(this, new EntityResultArgs<T>(r.Entities));
}
catch (Exception ex)
{
eventHandler(this, new EntityResultArgs<T>(ex));
}
}
},null);
}
public event EventHandler<EntityResultArgs<Data.Web.User>> GetAllUsersAsyncComplete;
public void GetAllUsersByLimit()
{
PerformQuery<User>(Context.GetUsersByLimitQuery(skip,PAGESIZE), GetAllUsersByLimitAsyncComplete);
}
public event EventHandler<EntityResultArgs<Data.Web.User>> GetAllUsersByLimitAsyncComplete;
}
Whenever i run the method GetAllUsersAysnc i always get this error :-
http://img408.imageshack.us/img408/6150/62968542.jpg
This is my app.config in MVVMDemo.Data.Web
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<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>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<connectionStrings>
<add name="IssueVisionEntities" connectionString="metadata=res://*/IssueVisionModel.csdl|res://*/IssueVisionModel.ssdl|res://*/IssueVisionModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=TAPESH\MSSQLSERVER2008;Initial Catalog=IssueVision;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.web>
<httpModules>
<add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</httpModules>
</system.web>
</configuration>
And this is my web.config of Asp.Net website which is hosting the silverlight application
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
</configuration>
I have no idea what is happening and I am a beginner in RIA services.