views:

1010

answers:

6

Has anybody been successful in integrating the Enterprise Library v4.0 with SharePoint WSS 3.0? I created a very simple .ASPX page. It's only purpose will to be to connect to an Oracle database and display some values in a DropDownList. But right now, all it does is displays Hello World. I've added the necessary references and everything compiles fine. When I test the page, it displays Hello World. But once I add the using Microsoft.Practices.EnterprisesLibrary.Data, the page no longer works. I just get the standard Unknown Error message. Is there a log file I can check?

I'm looking for any steps or tips that I can use to get this up and running. I use this Enterprise Library in all my ASP.NET applications and it works great. Trying to get this to work in SharePoint seems like a natural fit. But why does it seem so difficult? And why does there seem to be a lack of information?

Anyways, thank you so much for any information anybody can provide.

A: 

Are you able to debug and see where the failure is occurring in your code? Is it occurring on an Enterprise Library related call? If so I would capture the exception that is being thrown and evaluate the message that it provides using; try {} catch (Exception ex) {}.

One thing I have seen with Enterprise Library that if it is not properly configured it will sometimes log messages to the Event Log on the server.

I'm sorry I can't get much more information without more technical details about your implementation. I can assure you though that Enterprise Library works very well with SharePoint and that for the past few years I have used Enterprise Library in all of my SharePoint solution work.

spoon16
+1  A: 

I'm not sure about the Enterprise Library, but to get a more meaningful error message from SharePoint than the super informative "Unknown Error" message go modify a couple things in web.config:

  1. In <SharePoint><SafeMode> set the CallStack property = "true"
  2. In <system.web><compilation> set the debug property = "true"
  3. In <system.web><customErrors> set the mode property = "Off"
Cruiser
A: 

Thank you for the suggestions to modify the web.config. Now I can see the actual error messages. Here is what I'm seeing now. Thank you again for the help.


c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\CustomApps\RemoveOracleResp\Default.aspx.cs(9): error CS0234: The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) at System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

DrZ
A: 

Make sure you add the EntLib assemblies to the GAC and add them to the SafeControls section of your application's web.config...

axel_c
A: 

I've installed them to the GAC and added this to the web.config file and did iisreset. And I get the same error message.

  <SafeControl Assembly="Microsoft.Practices.EnterpriseLibrary.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="Microsoft.Practices.EnterpriseLibrary.Common" TypeName="*" Safe="True" /> 
  <SafeControl Assembly="Microsoft.Practices.EnterpriseLibrary.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="Microsoft.Practices.EnterpriseLibrary.Data" TypeName="*" Safe="True" />

This is what I have in my .cs file.

using Microsoft.Practices.EnterpriseLibrary.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;

Thanks again :)

DrZ
A: 

Follow up: the app I'm working on has it's own web.config file. I'm not sure if this is right or wrong. I've read where I should link the WSS web.config to my application and delete the one in my app folder. I tried that and when I did, I got an error message I've never seen.

So, I added the following to my local web.config

    <add assembly="Microsoft.Practices.EnterpriseLibrary.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add assembly="Microsoft.Practices.EnterpriseLibrary.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

and the error above disappears. My preference would be to use the web.config from WSS. I'm going to keep working on it and hope to find something that works so I can share.

DrZ