Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Error: login failed for user, in entity framework 1.0

Error: login failed for user, in entity framework 1.0

Scheduled Pinned Locked Moved ASP.NET
helpdatabasecsharpasp-netsql-server
14 Posts 2 Posters 11 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Hesham Amin

    Since the application pool user is not on the same domain, windows authentication won't work. How will SQL server know about your app pool user? It does not exist in Active Directory. You need to enable SQL authentication or make your machine join the domain which has the SQL server.

    Hesham A. Amin My blog twitter: @HeshamAmin

    I Offline
    I Offline
    indian143
    wrote on last edited by
    #5

    Salam Eid Mabrook, But the same thing is working in Enterprise Library, why only the Entity Framework giving the problems. But I don't have control on the SQL Server completely. Just in case I am asking for the debugging reason, what could be the reason if we SQL Server and my machine is on the same domain. Because when I am logging in to the SQL Server I am logging without using any domain. May be its on the same domain. But Enterprise library is able to connect it without using any domain name. If I am in the same domain what could cause the entity framework to get the database name in the context objects connection. Thanks in advance.

    Thanks & Regards, Abdul Aleem Mohammad St Louis MO - USA

    H 1 Reply Last reply
    0
    • I indian143

      Salam Eid Mabrook, But the same thing is working in Enterprise Library, why only the Entity Framework giving the problems. But I don't have control on the SQL Server completely. Just in case I am asking for the debugging reason, what could be the reason if we SQL Server and my machine is on the same domain. Because when I am logging in to the SQL Server I am logging without using any domain. May be its on the same domain. But Enterprise library is able to connect it without using any domain name. If I am in the same domain what could cause the entity framework to get the database name in the context objects connection. Thanks in advance.

      Thanks & Regards, Abdul Aleem Mohammad St Louis MO - USA

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #6

      Alikom AlSalam, Eid Mubarak :) Can you post the connection strings used in both cases? Does the DB admin allow public users on the database?

      Hesham A. Amin My blog twitter: @HeshamAmin

      I 1 Reply Last reply
      0
      • H Hesham Amin

        Alikom AlSalam, Eid Mubarak :) Can you post the connection strings used in both cases? Does the DB admin allow public users on the database?

        Hesham A. Amin My blog twitter: @HeshamAmin

        I Offline
        I Offline
        indian143
        wrote on last edited by
        #7

        Hi, Here are the connection strings.

        Thanks & Regards, Abdul Aleem Mohammad St Louis MO - USA

        H 1 Reply Last reply
        0
        • I indian143

          Hi, Here are the connection strings.

          Thanks & Regards, Abdul Aleem Mohammad St Louis MO - USA

          H Offline
          H Offline
          Hesham Amin
          wrote on last edited by
          #8

          Can you try to change the EF connection to:

          The difference between the connection strings is that the ENTLib connection connects to a named instance (LNIDDBTUMSQL24\STAYATWORK) while the EF connection connects to the default instance on LNIDDBTUMSQL24.

          Hesham A. Amin My blog twitter: @HeshamAmin

          I 1 Reply Last reply
          0
          • H Hesham Amin

            Can you try to change the EF connection to:

            The difference between the connection strings is that the ENTLib connection connects to a named instance (LNIDDBTUMSQL24\STAYATWORK) while the EF connection connects to the default instance on LNIDDBTUMSQL24.

            Hesham A. Amin My blog twitter: @HeshamAmin

            I Offline
            I Offline
            indian143
            wrote on last edited by
            #9

            Hi, I did it, I just copied database on my local machine and tried to connect using the following connection strings. In the place of Datasource value it is coming correct, but in the place of Database its always coming as empty String. Did I do any mistake during the entity frameworks mapping to the database because when I debugged following values are coming while connecting to my local database server also context.Connection.Datasource="(local)\STAYATWORK" or ".\STAYATWORK", context.Connection.Database="". Something should be wrong. Do I need to change anything in this

            should put the server name or something here. Following are the connection strings that I have used.

            Thanks & Regards, Abdul Aleem Mohammad St Louis MO - USA

            H 1 Reply Last reply
            0
            • I indian143

              Hi, I did it, I just copied database on my local machine and tried to connect using the following connection strings. In the place of Datasource value it is coming correct, but in the place of Database its always coming as empty String. Did I do any mistake during the entity frameworks mapping to the database because when I debugged following values are coming while connecting to my local database server also context.Connection.Datasource="(local)\STAYATWORK" or ".\STAYATWORK", context.Connection.Database="". Something should be wrong. Do I need to change anything in this

              should put the server name or something here. Following are the connection strings that I have used.

              Thanks & Regards, Abdul Aleem Mohammad St Louis MO - USA

              H Offline
              H Offline
              Hesham Amin
              wrote on last edited by
              #10

              Try to add

              Initial Catalog=STAYATWORK;

              to the connection string.

              Hesham A. Amin My blog twitter: @HeshamAmin

              I 2 Replies Last reply
              0
              • H Hesham Amin

                Try to add

                Initial Catalog=STAYATWORK;

                to the connection string.

                Hesham A. Amin My blog twitter: @HeshamAmin

                I Offline
                I Offline
                indian143
                wrote on last edited by
                #11

                Hi, Yes I added but its doing the same thing, its showing the database name as empty string, is entity framework having any problem connecting the database using Windows authentication. Thats what I am seeing when googling. Should I switch to SQL Server authentication? For that I need to talk to DBA. Please help me.

                Thanks & Regards, Abdul Aleem Mohammad St Louis MO - USA

                1 Reply Last reply
                0
                • H Hesham Amin

                  Try to add

                  Initial Catalog=STAYATWORK;

                  to the connection string.

                  Hesham A. Amin My blog twitter: @HeshamAmin

                  I Offline
                  I Offline
                  indian143
                  wrote on last edited by
                  #12

                  Hi, I found whats the problem is, if you can help me in solving it, it would be really great. When I am degging when Entity Framework class "StayAtWorkEntities" is trying to get the data from the SQL Server. There it is throwing exception, because application is trying to access the databse using "\" account instead of "\" account. But this "\" account, doesnt have access to the Database. Instead I have access to the database. Now is there any way to force IIS to run these two applications Web Application and a WCF Service under my user account "\". I am also admin on the Server is there any way to force IIS to do that, I have tried by changing the Application Pool Identity to "LocalSystem", "Network Service" in both the cases its running under the same user account "\" which doesnt have access rights to access the database.

                  Thanks & Regards, Abdul Aleem Mohammad St Louis MO - USA

                  H 1 Reply Last reply
                  0
                  • I indian143

                    Hi, I found whats the problem is, if you can help me in solving it, it would be really great. When I am degging when Entity Framework class "StayAtWorkEntities" is trying to get the data from the SQL Server. There it is throwing exception, because application is trying to access the databse using "\" account instead of "\" account. But this "\" account, doesnt have access to the Database. Instead I have access to the database. Now is there any way to force IIS to run these two applications Web Application and a WCF Service under my user account "\". I am also admin on the Server is there any way to force IIS to do that, I have tried by changing the Application Pool Identity to "LocalSystem", "Network Service" in both the cases its running under the same user account "\" which doesnt have access rights to access the database.

                    Thanks & Regards, Abdul Aleem Mohammad St Louis MO - USA

                    H Offline
                    H Offline
                    Hesham Amin
                    wrote on last edited by
                    #13

                    User accounts were lost from your post, but you can configure IIS App pool to run using any windows account. as mentioned here[^]. But select "Custom Account"

                    Hesham A. Amin My blog twitter: @HeshamAmin

                    I 1 Reply Last reply
                    0
                    • H Hesham Amin

                      User accounts were lost from your post, but you can configure IIS App pool to run using any windows account. as mentioned here[^]. But select "Custom Account"

                      Hesham A. Amin My blog twitter: @HeshamAmin

                      I Offline
                      I Offline
                      indian143
                      wrote on last edited by
                      #14

                      Yeah Hesham, I got it solved thanks for your help I have set my Windows user account on my Application pool Identity. Yes it has reolved all the problems. Now its working fine. Thanks a lot once again.

                      Thanks & Regards, Abdul Aleem Mohammad St Louis MO - USA

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups