“The system cannot find the file specified”

后端 未结 10 788
执念已碎
执念已碎 2020-11-29 11:17

I saw many questions on SO with this error. But none were related to forms. I just hosted my application server after testing locally. I think it worked for a few mins but I

相关标签:
10条回答
  • 2020-11-29 11:35

    If you encounter this error in GoDaddy after deploying a .Net MVC web application..And your web.config is absolutely correct... Right click your data project select settings and make sure that the correct connection strings to the GoDaddy server is in use

    0 讨论(0)
  • 2020-11-29 11:36

    Server Error in '/' Application.

    The system cannot find the file specified

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ComponentModel.Win32Exception: The system cannot find the file specified

    Source Error:

         {
                       SqlCommand cmd = new SqlCommand("select * from tblemployee",con);
                       con.Open();
                       GridView1.DataSource = cmd.ExecuteReader();
                       GridView1.DataBind();
    

    Source File: d:\C# programs\kudvenkat\adobasics1\adobasics1\employeedata.aspx.cs Line: 23

    if your error is same like mine..just do this

    right click on your table in sqlserver object explorer,choose properties in lower left corner in general option there is a connection block with server and connection specification.in your web config for datasource=. or local choose name specified in server in properties..

    0 讨论(0)
  • 2020-11-29 11:44

    I had this error and I found that the name of one of my connection strings was wrong. Check the names as well as the actual string.

    0 讨论(0)
  • 2020-11-29 11:47

    I got same error after publish my project to my physical server. My web application works perfectly on my computer when I compile on VS2013. When I checked connection string on sql server manager, everything works perfect on server too. I also checked firewall (I switched it off). But still didn't work. I remotely try to connect database by SQL Manager with exactly same user/pass and instance name etc with protocol pipe/tcp and I saw that everything working normally. But when I try to open website I'm getting this error. Is there anyone know 4th option for fix this problem?.

    NOTE: My App: ASP.NET 4.5 (by VS2013), Server: Windows 2008 R2 64bit, SQL: MS-SQL WEB 2012 SP1 Also other web applications works great at web browsers with their database on same server.


    After one day suffering I found the solution of my issue:

    First I checked all the logs and other details but i could find nothing. Suddenly I recognize that; when I try to use connection string which is connecting directly to published DB and run application on my computer by VS2013, I saw that it's connecting another database file. I checked local directories and I found it. ASP.NET Identity not using my connection string as I wrote in web.config file. And because of this VS2013 is creating or connecting a new database with the name "DefaultConnection.mdf" in App_Data folder. Then I found the solution, it was in IdentityModel.cs.

    I changed code as this:

    public class ApplicationUser : IdentityUser
    {
    }
    
    public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
    {
        //public ApplicationDbContext() : base("DefaultConnection") ---> this was original
        public ApplicationDbContext() : base("<myConnectionStringNameInWebConfigFile>") //--> changed
        {
        }
    }
    

    So, after all, I re-builded and published my project and everything works fine now :)

    0 讨论(0)
提交回复
热议问题