Export to GitHub

mybatisnet - issue #5

Can't host ibatis in WCF IIS site without asp.net compat.


Posted on Jul 30, 2010 by Happy Rhino

Can't host ibatis in WCF IIS site without asp.net compat.

Comment #1

Posted on Aug 31, 2010 by Happy Wombat

How so? I use IBatis in several WCF services not in ASP.NET 2.0 compatibility mode. Just make sure all of the resources are embedded and you should be fine. Or are you asking for support for non-embedded resources in a WCF solution?

Comment #2

Posted on Aug 31, 2010 by Happy Rhino

Which transport type are you using ? I've seen problems getting the session when the wcf services are hosting on IIS 6 when it attempts to use the WebSession Manager due to the site not having there not being a web session.

Comment #3

Posted on Sep 1, 2010 by Happy Wombat

The WCF services I've built also run on IIS 6. You can run iBatis without an HttpContext if you do the following when you initialize your mapper(s) (VB.NET):

Protected Sub InitMapper(ByRef mapper As ISqlMapper, ByVal embeddedResource As String)

    Dim builder As New DomSqlMapBuilder()

    Dim properties As New NameValueCollection()
    properties.Add("connectionString", Me.ConnectionString)
    builder.Properties = properties

    mapper = builder.Configure(Resources.GetEmbeddedResourceAsXmlDocument(embeddedResource))
    mapper.SessionStore = New HybridWebThreadSessionStore(mapper.Id)

End Sub

The "HybridWebThreadSessionStore" will allow you to run iBatis outside the context of a web session. This also allows us to use iBatis queries as a datasource for SSRS reports and other things that don't use a web session.

Comment #4

Posted on Jul 6, 2012 by Massive Elephant

The 1.6.2 version and later version has resolve this problem underlying.

Status: New

Labels:
Type-Defect Priority-High