Results 1 to 3 of 3

Thread: Q. Asmx and WCF in a single project

  1. #1
    Join Date
    Jun 2007
    Posts
    155

    Question Q. Asmx and WCF in a single project

    Hi All!

    Do not ask me why, but I need to have both asmx and wcf service from a single project. Nothing fancy about service itself. All configuration is pretty standard for both platforms.

    With one caveat. If I request asmx first it works just fine. If first request hit svc, then I have following.

    Code:
    NullReferenceException: Object reference not set to an instance of an object.]
       Spring.Util.HttpRuntimeEnvironment.get_CurrentVirtualPath() +64
       Spring.Util.VirtualEnvironment.get_CurrentVirtualPath() +29
       Spring.Util.VirtualEnvironment.get_CurrentVirtualPathAndQuery() +30
       Spring.Context.Support.WebApplicationContext..ctor(String name, Boolean caseSensitive, IApplicationContext parentContext, String[] configurationLocations) +131
       Spring.Context.Support.WebApplicationContext..ctor(String name, Boolean caseSensitive, String[] configurationLocations) +47
       _dynamic_Spring.Context.Support.WebApplicationContext..ctor(Object[] ) +220
       Spring.Reflection.Dynamic.SafeConstructor.Invoke(Object[] arguments) +42
       Spring.Context.Support.RootContextInstantiator.InvokeContextConstructor(ConstructorInfo ctor) +241
       Spring.Context.Support.ContextInstantiator.InstantiateContext() +168
       Spring.Context.Support.ContextHandler.InstantiateContext(IApplicationContext parentContext, Object configContext, String contextName, Type contextType, Boolean caseSensitive, String[] resources) +152
       Spring.Context.Support.WebContextHandler.InstantiateContext(IApplicationContext parent, Object configContext, String contextName, Type contextType, Boolean caseSensitive, String[] resources) +399
       Spring.Context.Support.ContextHandler.Create(Object parent, Object configContext, XmlNode section) +559
    
    [ConfigurationErrorsException: Error creating context 'spring.root': Object reference not set to an instance of an object.]
       System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) +202
       System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) +1061
       System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) +1431
       System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission) +56
       System.Configuration.BaseConfigurationRecord.GetSection(String configKey) +8
       System.Web.Configuration.HttpConfigurationSystem.GetApplicationSection(String sectionName) +45
       System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName) +49
       System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey) +6
       System.Configuration.ConfigurationManager.GetSection(String sectionName) +78
       Spring.Util.ConfigurationUtils.GetSection(String sectionName) +151
       Spring.Context.Support.ContextRegistry.InitializeContextIfNeeded() +110
       Spring.Context.Support.ContextRegistry.GetContext() +71
       Spring.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String reference, Uri[] baseAddresses) +80
       System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +11729164
       System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +42
       System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +479
    
    [ServiceActivationException: The service '/EDocumentPreferenceService.svc' cannot be activated due to an exception during compilation.  The exception message is: Error creating context 'spring.root': Object reference not set to an instance of an object..]
       System.ServiceModel.AsyncResult.End(IAsyncResult result) +11599786
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +194
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +176
       System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +278
       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
    Once WebContextHandler started everything works fine.

    Is this doable at all?

  2. #2
    Join Date
    Aug 2013
    Posts
    2

    Default

    Hello,

    We have the exact same behaviour. Was this ever resolved? If so, how or what workaround was used?

    Thanks!

  3. #3
    Join Date
    Aug 2013
    Posts
    2

    Default

    Fixed it by replacing
    <section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web" />
    with
    <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Web" />

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •