CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!
Free 3 Months



Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_studio_2008 Tags:
Item Type: NewsGroup Date Entered: 1/20/2008 10:24:36 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 12 Views: 28 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
13 Items, 1 Pages 1 |< << Go >> >|
juststeve
Asp.Net User
Web App unable to get same data that a sibling WinForm App gets1/20/2008 10:24:36 AM

0/0

 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"

rjcox
Asp.Net User
Re: Web App unable to get same data that a sibling WinForm App gets1/20/2008 3:34:39 PM

0/0

Easiest solution here is to create a single user that is used for a new application pool to which the virtual directory of your web application is assigned. And give that user necessary permissions to your database. The inbuilt services have an interesting mix of access and permissions for historical reasons and you gain nothing much in using them.

If the database is on a different machine make create the account in the domain (or, in a workgroup) ensure both machines have accounts with the same name and the same password. 


Richard
juststeve
Asp.Net User
Re: Web App unable to get same data that a sibling WinForm App gets1/20/2008 6:33:37 PM

0/0

Any more details to pay attention trying this route? I've taken an existing account that's a member of admin group - logged in via RDC just to be sure i had the pw correct - but get:

The identity of application pool 'ASP.NET V2.0' is invalid, so the World Wide Web Publishing Service can not create a worker process to serve the application pool.  Therefore, the application pool has been disabled.

Any other things to set or otherwise pay attention to while trying this operation? There's lots about user configuration, App Pools, & IIS that i don't know squat about.

But at the bigger picture level....

More and more i wonder about my overlying framework where 2 different UI projects (one Winform and one WS) access a 3rd project responsible for accessing the database. It just seems plain wrong to me that these UI projects need to know anything at all about the db.

These UI projects are _not connecting to the database - they are calling a method from a different project that in turn connects to the database.

Perhaps I need to work harder to separate database dependencies away from the UI projects. Break them out to separate VS solutions?

 

rjcox
Asp.Net User
Re: Web App unable to get same data that a sibling WinForm App gets1/20/2008 10:19:42 PM

0/0

juststeve:
The identity of application pool 'ASP.NET V2.0' is invalid, so the World Wide Web Publishing Service can not create a worker process to serve the application pool.  Therefore, the application pool has been disabled.
 

That indicates either the account is disabled, or the password is wrong (I've seen this when the application pool's account's password had expired).

As to the rest, it should be OK, but sometimes niggely little details can be hard to all get right.

E.g. common layer needs to have an identity that can access the database, front end (which ever) has to have an identity that can access the common layer. Tools like Process Monitor and enabling login/logoff auditting plus the security event log can help to start to sort things out. 


Richard
juststeve
Asp.Net User
Re: Web App unable to get same data that a sibling WinForm App gets1/21/2008 2:28:31 PM

0/0

I've triple checked the password. I can login via RDC, start SQL's Management Studio and browse the db in question.

Somewhere while goggling this errormsg i saw it suggested that the Identity be set to local system long enough to see if the error resovles...then to work backward from there. I get the same behavior at local system, local service, network service - no results from the db but no error to the event log. Setting identity to the a local user will not log anything to Security but I don't know that I'm trapping the right events. ProcMon shows a couple 'NAME_NOT_FOUNDs on winlogon.exe but no failures....but again...I don't know what to look for/filter on.

rjcox
Asp.Net User
Re: Web App unable to get same data that a sibling WinForm App gets1/21/2008 2:46:59 PM

0/0

Can you do that remotely (run SQL Management Studio on a different system)?

 


Richard
juststeve
Asp.Net User
Re: Web App unable to get same data that a sibling WinForm App gets1/21/2008 5:31:53 PM

0/0

I connect remotely but use SQLServer credentials. The box sits at a remote host - a server farm - so there's no way (that I know of) to assume a given Window accounts identity before hitting SQL.

rjcox
Asp.Net User
Re: Web App unable to get same data that a sibling WinForm App gets1/21/2008 6:12:04 PM

0/0

Use runas to locally run something as a different user. 


Richard
juststeve
Asp.Net User
Re: Web App unable to get same data that a sibling WinForm App gets1/21/2008 6:57:24 PM

0/0

Am able to execute the 'RunAs' from that box via my RDC session...not from my local workstation.

juststeve
Asp.Net User
Re: Web App unable to get same data that a sibling WinForm App gets1/21/2008 9:50:44 PM

0/0

 Made a bit of progress here... I've found a blog entry describing the same error i'm tossing. The relevent bit is:

To cut to the chase, the problem is that Windows Server 2003 SP1 has revoked rights/permissions on the ASPNET account, that cannot be restored even by placing it in the Administrators group. The way to fix the problem is:

Go to the .NET Framework Folder (typically c:\Windows\Microsoft.NET\Framework\v1.1.4322)

aspnet_regiis -ua to uninstall the framework

aspnet_regiis -i to reinstall the framework

In IIS Manager:

Enable ASP.NET pages

In User manager (compmgmt.msc)

Set the ASPNET account with the password on the SQL server, and as a member of IIS_WPG

In IIS Manager:

Set the Application pool to run under the account with the password entered from the previous step

At the Run command:

iisreset to reset IIS

gpupdate /force to ensure password synchronization<br>http://adamgetchell.blogspot.com/2005/04/fun-with-aspnet-security-and-windows.html


I'm unclear on the line: 

Set the ASPNET account with the password on the SQL server, and as a member of IIS_WPG

 

Any idea which account 'on the SQL server' would be referencing?
 

Mikhail Arkhipo
Asp.Net User
Re: Web App unable to get same data that a sibling WinForm App gets1/22/2008 5:52:21 AM

0/0

It seems that the problem is that WinForms application runs under credentials of the user who launched the application. Web application is not running under any user account. It is running as a network service under ASPNET account. Therefore you either need to set up ASP.NET to impersonate a user or add ASPNET as a user to the database and specify appropriate credentials in, say, web.config.


Thanks

------------------------------------------------------------

This posting is provided "AS IS" with no warranties, and confers no rights.
Mikhail Arkhipo
Asp.Net User
Re: Web App unable to get same data that a sibling WinForm App gets1/22/2008 5:53:04 AM

0/0

Some more information here http://msdn2.microsoft.com/en-us/library/xh507fc5(VS.71).aspx


Thanks

------------------------------------------------------------

This posting is provided "AS IS" with no warranties, and confers no rights.
juststeve
Asp.Net User
Re: Web App unable to get same data that a sibling WinForm App gets1/22/2008 10:17:20 AM

0/0

Given that I'm getting the same results when testing with the app pool running as Local System haven't i taken the whole 'runs as/under' question out of the equation?

13 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Web App unable to get same data that a sibling WinForm App gets ... Web App unable to get same data that a sibling WinForm App gets. Last post 01-22 -2008 5:17 AM by juststeve. 12 replies. Sort Posts: ...
Visual Studio 2008 - ASP.NET Forums Web App unable to get same data that a sibling WinForm App gets by juststeve ... VS2008 project conversion error - Unable to save converted project. ...
Web App unable to get same data that a sibling WinForm App gets ... 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 ...
.NET - Bytes Site Map C#-APP: Not able to get values of controls in TabPage .... Creating a Search Button in a Windows Form Application · How to debug vb 6.0 dll from C#. ...
TheMSsForum.com >> Asp >> Either ValidationProperty or ... Unable to start debugging on the web server When I select "Debug->Start" from the menu to debug my ASP.NET web app, I get the following error message in a ...
Jelle Druyts - Blog|Programming|.NET|ASP.NET That means that if you host your client (e.g. a web app) and server (remoting ...... The trick is, you can get to the data source fields through the ...
CodeGuru Forums - Visual C++ Programming CRecentFileList in a dialog app ? Help with disabling keyboard shortcuts. ... Why get different result in VC with ADO and in Access directly ...
CodeProject: Additional custom panel in Microsoft Outlook. Free ... Jun 25, 2008 ... Like any other Windows application, the main window of Microsoft ... private void ResizePanels() { //Get size of the sibling window and main ...
April 2008 - Posts - Just code - Tamir Khason For almost all elements, used in WordML we have sibling WPF class. .... So, let’ s first get the main application window handle, then create rectangle bounds ...
.NET VB Page 82 - Bytes Site Map NET · Mixing C# files and aspx files in a Web app? how to catch the return code of one VB.Net executable from another VB.net executable ...




Search This Site:










saving state? other then session(or application)?

how to you write a "does not equal to"?

setting up webmatrix

dllimport in asp.net

my business object

av chat application

overload resolution failed because no accessible 'add' accepts this number of arguments.

string + formating

why the asp code gets ignored

the ilistsource does not contain any data sources

changing properties of a control based on a dropdownlist

whats the best asp.net email component?

email after a new record has been inserted.

creating an inheritance chart

how to download webcasts from microsoft website?

classified ad code

help with connection strings

can i set the dropdownlist id name by myself while use repeater?

working with zip files

passing asp values to javascript function

running framework 3.5 in local

asp.net math website

session variables

how to create a public default constructor that cannot be called

doing actions when browser is going to close

enabled tracing

creating a function that returns a generic list of a given type

sessions asp.net

asp.net hosting.

msde not working under iis

  Privacy | Contact Us
All Times Are GMT