Publish ASP.NET MVC Project with Local DB on Server not has SQL Server installed on it

mostafa ahmed 21 Reputation points
2022-04-03T04:45:18.343+00:00

I am developed ASP.NET MVC 5 Project, and I using local SQL Server database, I want to publish the Project on IIS Local server, But this IIS Local server do not have SQL Server, The SQL Server not installed in that local server

Can I publish project on that server or not?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,080 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,222 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,488 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. SurferOnWww 1,796 Reputation points
    2022-04-03T07:46:58.127+00:00

    The LocalDB needs user profile to be loaded. Therefore, you will not be able to use the LocalDB on IIS as the worker process by default does note have the user profile.

    However, there seems to be some workarounds although I do not know if they can help you:

    Using LocalDB with Full IIS, Part 1: User Profile
    https://learn.microsoft.com/en-us/archive/blogs/sqlexpress/using-localdb-with-full-iis-part-1-user-profile

    Using LocalDB with Full IIS, Part 2: Instance Ownership
    https://learn.microsoft.com/en-us/archive/blogs/sqlexpress/using-localdb-with-full-iis-part-2-instance-ownership


  2. Erland Sommarskog 100.1K Reputation points MVP
    2022-04-03T10:02:50.263+00:00

    Presumably there is an SQL Server instance somewhere in the environment. If there is not, it will be difficult. :-)

    So the first thing is to ask the IT people which SQL Server instance you should use. Then you go on and create database, tables etc that you need in the database on that instance. Next, you will need to modify your connection string to refer to that instance instead. Or rather you probably read the information from a config file, so that the server etc can be changed without touching the code.

    LocalDB, if is that is what you have been using, is a thing to facilitate development, and it can also be used for simple one-person applications. However, it is nothing you would use for a web application.

    In the system I work with, we actually have IIS and SQL Server on the same machine, but I think that in most shops you have IIS and SQL Server running on two different dedicated servers.

    0 comments No comments

  3. Bruce (SqlWork.com) 53,501 Reputation points
    2022-04-03T15:20:17.34+00:00

    LocalDb is not really designed to be used for production. You would be better served to switch to SQLite which was designed for the scenario you want.

    0 comments No comments

  4. Zhi Lv - MSFT 31,946 Reputation points Microsoft Vendor
    2022-04-04T09:07:39.737+00:00

    Hi @mostafa ahmed ,

    I am developed ASP.NET MVC 5 Project, and I using local SQL Server database, I want to publish the Project on IIS Local server, But this IIS Local server do not have SQL Server, The SQL Server not installed in that local server

    Can I publish project on that server or not?

    You can publish the app to the server. But, if your app needs SQL Server, there must be SQL Server available on the server, either on that IIS Server itself, or on another server that is reachable from that IIS Server via the network, or you can try to use Azure SQL Server service. Otherwise you can't do any database operations and may report an error when running the application.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion

    0 comments No comments