Working in VS08/3.5 on project based very closely off EntLib's DataAccess QuickStart.
The sln has 3 projects -
1. VB Class Library (CMS) to provide db access to the other UI projects
2. Winform (WinFormUI) - references CMS to show output to conventional WinForm (bascially I just broke the QuickStart's Winform to a seperate project and then referenced CMS)
3. WebServices app to provide SOAP output of the same db
WinForm works correctly so at least I've gotten that far.
The WebService app is calling the correct function in CommonData breakpoints are set at these 2 lines:
Dim db As Database = DatabaseFactory.CreateDatabase()
Dim sqlCommand As String = "Select CustomerID, Name From Customers"
Execution hits the first but not the 2nd. The calling method gets an exception of message:
- ex {"The value can not be null or an empty string."} System.Exception
(stack trace pasted at end of msg)
I've used EntLib's GUI to define a connectionstring to match the string used in the other two projects:
<connectionStrings>
<add name="DataAccessQuickStart" connectionString="server=(local)\SQLEXPRESS;database=EntLibQuickStarts;Integrated Security=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
other two:
<dataConfiguration defaultDatabase="DataAccessQuickStart"/>
<connectionStrings>
<add
name="DataAccessQuickStart"
providerName="System.Data.SqlClient"
connectionString="server=(local)\SQLEXPRESS;database=EntLibQuickStarts;Integrated Security=true" />
</connectionStrings>
<dataConfiguration defaultDatabase="DataAccessQuickStart"/>
The web app's bin dir also includes the same Microsoft.Practices.EnterpriseLibrary.Data.dll as the other 2 projects.
Besides being clueless as to where/why/how to deal with this failure I'm really confused by the fact that the 2 UI projects have to carry the same db references that the dataproject is holding. Seems like UI shouldn't have to be coupled to the backend so tightly.
Event log carries this error:
401.5 Access Denied - Authorization failed by ISAPI/CGI application.
I've seen a post suggesting to set the AppPool's identity to Local Service and now get:
System.InvalidOperationException: Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\WINDOWS\TEMP\r9nzi4po.0.cs' could not be found
error CS2008: No inputs specified
at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Evidence evidence)
at System.Web.Services.Protocols.XmlReturn.GetInitializers(LogicalMethodInfo[] methodInfos)
at System.Web.Services.Protocols.XmlReturnWriter.GetInitializers(LogicalMethodInfo[] methodInfos)
at System.Web.Services.Protocols.MimeFormatter.GetInitializers(Type type, LogicalMethodInfo[] methodInfos)
at System.Web.Services.Protocols.HttpServerType..ctor(Type type)
at System.Web.Services.Protocols.HttpServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
StackTrace " at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConfigurationView.ValidateInstanceName(String name)
at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConfigurationView.GetConnectionStringSettings(String name)
at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseCustomFactory.CreateObject(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id)
at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
at Microsoft.Practices.ObjectBuilder.SingletonStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfigurationNameMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id)
at Microsoft.Practices.ObjectBuilder.BuilderBase`1.DoBuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies)
at Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies)
at Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp[TTypeToBuild](IReadWriteLocator locator, String idToBuild, Object existing, PolicyList[] transientPolicies)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IReadWriteLocator locator, IConfigurationSource configurationSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IConfigurationSource configurationSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.NameTypeFactoryBase`1.CreateDefault()
at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase()
at CMS.CMSData.GetCustomerList() in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\CMS\CMSData.vb:line 32
at CMSws.GetCustomerList() in C:\Inetpub\wwwroot\TTSRoot\TTS\App_Code\CMSws.vb:line 29"