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

  • Home
  • SEARCH
  • 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 494355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:29:21+00:00 2026-05-13T05:29:21+00:00

I’m working with an application which uses wcf and sharp architecture, I’m trying to

  • 0

I’m working with an application which uses wcf and sharp architecture, I’m trying to create a service to write to the database. Here is my service:

[ServiceContract]
public interface IFacilitiesWcfService : ICloseableAndAbortable
{
    [OperationContract]
    void AddFacility(string facility);

}

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
class FacilitiesWcfService:IFacilitiesWcfService
{
    public FacilitiesWcfService(IRepositoryWithTypedId<Facility,string> facilityRepository)
    {
        Check.Require(facilityRepository != null, "facilityRepository may not be null");

        this.facilityRepository = facilityRepository;
    }
    private readonly IRepositoryWithTypedId<Facility,string> facilityRepository;

    public void AddFacility(string facility)
    {
        facilityRepository.DbContext.BeginTransaction();

        Facility newFacility = new Facility();
        newFacility.SetAssignedIdTo(facility);
        newFacility.NAME=facility;
        newFacility.ADDRESS = facility;

        facilityRepository.DbContext.CommitTransaction();
    }
    public void Abort() { }

    public void Close() { }
}

And the LogisticsWCF.svc file in the web project:

<%@ ServiceHost Language="C#" Debug="true" Service="Project.Wcf.FacilitiesWcfService"
 Factory="SharpArch.Wcf.NHibernate.ServiceHostFactory, SharpArch.Wcf" %>

I created a client with svcutil.exe http://localhost:1905/LogisticsWCF.svc?wsdl and then created this test case:

[TestFixture]
class WCFLogisticsTests
{
    [Test]
    public void CanAddFacility()
    {

        FacilitiesWcfServiceClient facility = new FacilitiesWcfServiceClient();
        facility.AddFacility("NEW");
        facility.Close();
    }
}

But I get this exception:

TestCase 'Tests.Project.Web.WCFLogisticsTests.CanAddFacility'
failed: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail] : The needed dependency of type FacilitiesWcfService could not be located with the ServiceLocator. You'll need to register it with the Common Service Locator (CSL) via your IoC's CSL adapter.

    Server stack trace:
    at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
    at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Exception rethrown at [0]:
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
    at IFacilitiesWcfService.AddFacility(String facility)
    C:\Documents and Settings\epena\My Documents\SVN\Project\tests\Project.Tests\FacilitiesWcfService.cs(58,0): at FacilitiesWcfServiceClient.AddFacility(String facility)
    WCFLogisticsTests.cs(18,0): at Tests.Project.Web.WCFLogisticsTests.CanAddFacility()


0 passed, 1 failed, 0 skipped, took 4.52 seconds (NUnit 2.5.2).

I think I’m missing some configuration of sharp architecture, because when I don’t use Factory="SharpArch.Wcf.NHibernate.ServiceHostFactory, SharpArch.Wcf" in the .svc file I don’t get the exception, but I’m not able to write anything to the database ( I get an ISession not configured exception).

I tried to follow the Northwind example, but it’s not working, What can I be missing?

  • 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-05-13T05:29:21+00:00Added an answer on May 13, 2026 at 5:29 am

    Finally I’ve found the answer, I was missing the following line in the ComponentRegistrar:

    container.AddComponent("facilityWcfService", typeof(FacilitiesWcfService));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.