Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8791243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:48:58+00:00 2026-06-13T22:48:58+00:00

this is my first question on this page, so first of all sorry for

  • 0

this is my first question on this page, so first of all sorry for any newbie mistakes and my bad english.

I wouldn’t be asking on a page like this if I didn’t ran out of ideas on how to solve my problem, so I hope I get it to work with your help since it’s my last chance.

I created a program in C# using NHibernate to connect it to my Oracle database (wich is working perfectly), and now I’ve been told to create a similar program, but now in a Windows Service instead of a .exe.

The problem is that I have all the settings done to make NHibernate work like in the .exe program, and if i debug the program it all works fine, but as soon as I install the service and run it, stops working.

I’m not doing anyhing in the program, just testing the NHibernate connection.

The exception:

Could not compile the mapping document: Mapping\CSB_Mensaje.hbm.xml
System.IO.DirectoryNotFoundException: No se puede encontrar una parte de la ruta de acceso 'C:\Windows\system32\Mapping\CSB_Mensaje.hbm.xml'.
   en System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   en System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
   en System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
   en System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
   en System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
   en System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver)
   en System.Threading.CompressedStack.runTryCode(Object userData)
   en System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   en System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state)
   en System.Xml.XmlTextReaderImpl.OpenUrl()
   en System.Xml.XmlTextReaderImpl.Read()
   en System.Xml.XmlTextReader.Read()
   en System.Xml.XmlCharCheckingReader.Read()
   en System.Xml.XsdValidatingReader.Read()
   en System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   en System.Xml.XmlDocument.Load(XmlReader reader)
   en NHibernate.Cfg.Configuration.LoadMappingDocument(XmlReader hbmReader, String name)

The part of the exception on spanish, says it can’t find a part of the access path.

This exception is thrown while trying to execute this code:

private static void Init(String BBDD)
    {
        Configuration config = new Configuration();
        config.Configure().SessionFactoryName(BBDD);
        config.AddFile("Mapping\\CSB_Mensaje.hbm.xml");
        config.AddFile("Mapping\\CSB_Periodicidad.hbm.xml");
        config.AddFile("Mapping\\CSB_Plantilla.hbm.xml");
        config.AddFile("Mapping\\CSB_Subscripciones.hbm.xml");
        config.AddFile("Mapping\\CSB_Usuario.hbm.xml");
        config.AddFile("Mapping\\CSB_Login.hbm.xml");
        config.AddFile("Mapping\\CSB_Configuration.hbm.xml");
        _SessionFactory = config.BuildSessionFactory();
    }

And this is my hibernate.cfg.xml file:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
  <session-factory name="Oracle">
    <property name="connection.provider">
      NHibernate.Connection.DriverConnectionProvider
    </property>
    <property name="dialect">
      NHibernate.Dialect.Oracle10gDialect
    </property>
    <property name="connection.driver_class">
      NHibernate.Driver.OracleClientDriver
    </property>
    <property name="connection.connection_string">
      User Id=CSB;
      Password=Hound2012;
      Data Source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521)))(CONNECT_DATA = (SID = HL)));
    </property>
    <property name="show_sql">
      true
    </property>
  </session-factory>
</hibernate-configuration>

Again, this is my first time asking something here, so I’m sorry for any mistake made. Any help would be greatly apreciated.

Regards,
Khor

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:48:58+00:00Added an answer on June 13, 2026 at 10:48 pm

    This line of the exception message indicates the problem:

    System.IO.DirectoryNotFoundException: No se puede encontrar una parte de la ruta de acceso 'C:\Windows\system32\Mapping\CSB_Mensaje.hbm.xml'.
    

    I think the problem is that you are using relative paths here:

    config.AddFile("Mapping\\CSB_Mensaje.hbm.xml");
    

    Try specifying the actual path to the mapping files.

    Alternatively, mark your mapping files as embedded resources and let NHibernate find them in the assembly instead of telling the configuration about each one individually (see The NHibernate Wiki).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first of all sorry by my bad english, Hello i am new in this
First of all, sorry if this question is a little vague and rambling! I'm
this is my first question in here, and I would like to ask if
this is my first question I have searched for any launching activity questions and
Sorry for the newbie question, but I can't seem to figure this out. I
All, Sorry - this is probably a very strange question. I'm working on a
First of all, sorry for my English :) I'm web developer. Generally coding in
Note first of all that this question is not tagged winforms or wpf or
First of all sorry if its a noob question. But is it posibble to
This is my first question on Stack Overflow, so I hope that I'm clear

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.