I'm programmed a web application on visual studio by ASP.Net C# and local database. then i want to create installer for this web application to do these actions on a target PC:
Install requirements for database
Install IIS on PC
Publish my Web Application as an website on IIS
NOTE
Actually, this web application should be run on a LAN that consist 3 PC and one router. one of that PC's should be a server and the web application must be installed on that system, then the other PC's getting to use from web application on a LAN.
Update
I'm used from Advanced Installer and setup works fine. but when i start the website in client system, always get this error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
and this is my connection string in web.config:
<add
name="SetupTestEntities"
connectionString="metadata=
res://*/Model.csdl|
res://*/Model.ssdl|
res://*/Model.msl;
provider=System.Data.SqlClient;
provider connection string="
data source=(LocalDB)\v11.0;
attachdbfilename=|DataDirectory|\SetupTest.mdf;
integrated security=True;
connect timeout=30;
MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
You can use the Professional edition of Advanced Installer. This edition has support to install:
IIS web sites, app pools, web apps and virtual directories
install windows features without writing any scripting
install prerequisites, thus your requirements for your database
Advanced Installer also supports running SQL scripts, so you could create on the fly your databases and populate them with your defaults, but this feature is available in the Enterprise edition.
In the end Advanced Installer will build and MSI or EXE installer as output (depending on what you want), that you can use to deliver your application to any machine.
(disclaimer: I work on this product)
Related
I have developed an ASP.NET MVC 5 project, and I am using a local SQL Server database.
I want to publish that project on an IIS Local server, but this IIS local server does not have SQL Server. The SQL Server is not installed on that local server.
Can I publish project on that server or not?
Yes you can publish your app on your server which SQL Server is not installed on it; but you should have another server (at least) which the SQL Server is installed on that and set your app connection string on that server, so your project will be connected to the DB.
You can do that with cloud base services!
But you should be aware of security issues.
If you can not install SQL Server on your own server because of OS, low resources, maintenance issues and etc. this solution may be help you.
These two articles from Microsoft may be helpful:
1.
Connecting from Another Computer
2.
Import or link to data in an SQL Server database
I've developed a .NET (windows forms application) that i want to distribute to a friend which is not a developer. When my friend opens the generated .exe file as administrator on her computer, this error comes up.
"Error: A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that instance name is correct and that SQL
Server id configured to allow remote connections. (Provider: SQL
Network Interfaces, error: 52 - Unable to locate a Local Database
Runtime installation. Verify that SQL Express is properly installed
and that the local Database Runtime feature is enabled.)"
From the error it seems like the application crashed because the database is not installed on my friends computer. This leaves me behind with the following questions.
1) How would someone distribute a .NET application using a service-based database?
2) Should I make an installation file (visual studio 2019) that also installs the database and eventually the .NET framework. If yes, how should I do that in visual studio 2019?
3) From the word service-based database it seems like this database is running on some server somewhere? Is this server my own computer? Or can I access this server from another computer?
I just published my Blazor CRUD example to the local server. Website is working well, but I get HTTP Error 500 when I go to the fetch data page. Everything works well when I run on the Visual Studio, but IIS server. I have the connection string in context file. I also edited the connection string on the Application Pool settings page, but still not working.
This is the code piece I am using on the context file:
optionsBuilder.UseSqlServer(#"Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=master;Trusted_Connection=True;");
I also use this connection string for the IIS:
The answer is that there are two different LocalDB instances here. Unlike SQL Server Express instances, which are running as Windows services, LocalDB instances are running as user processes. When different Windows users are connecting to LocalDB, they will end up with different LocalDB processes started for each of them. When we connect to (localdb)\v11.0 from Visual Studio, a LocalDB instance is started for us and runs as our Windows account. But when Web Application, running in IIS as ApplicationPoolIdentity, is connecting to LocalDB, another LocalDB instance is started for it and is running as ApplicationPoolIdentity! In effect, even though both Visual Studio and Web Application are using the same LocalDB connection string, they are connecting to different LocalDB instances. Obviously the database created from Visual Studio on our LocalDB instance will not be available in Web Application's LocalDB instance.
Easy fix is using SQL Server Express instead of LocalDB
More details - https://blogs.msdn.microsoft.com/sqlexpress/2011/12/08/using-localdb-with-full-iis-part-2-instance-ownership/
I developed an application in C# using visual studio 2015. But when I published the application and run it on another system. It gives the following exceptions.
" A network related or instance specific error occurred while establishing a connection to SQL server. The server was not found or was not accessbile. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. Unable to locate a local database runtime installation.
While publishing database, we need to cleanup the dev configurations a little further.
In the connection string check what is the Database server name on your client hosting environment and include that in: Data Source="Client database host server name"
Also instead of providing .mdf file ( as specified in your connection string with AttachDbFilename='C:\Users...'), better would be either generate the script from SQL Management studio in your local and run those in your client environment.
If it is by requirement to provide .mdf file then make sure the path to mdf file in hosting environment matches to what you give in your connection string.
Or else you can provide mdf file to client ask them to attach it to the hosted database server.
Often, Integrated Security might not be provided on host servers. So check the userid/password with your client on hosting machine to connect and update them in your connection string.
Hope some of these point might help you.
I have developed an inventory system in C# ,database used is SQL server .Now my problem is how to deploy my project with database and run it on client's machine i have 1 more week remaining in delivering this project .I tried many blogs and sites but all in vain and i did not get any good resource which clearify me all this scenerio.The current publishing process does not have a database file and showing me an error :
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections
Please any suggestions would be highly appreciable?
I am using Visual Studio 2013 and SQL Server 2012!
By default, SQL Server have network access disabled after a fresh install. You need to use the SQL Configuration Manager to allow remote connections to the instance.
See this post:
http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx
http://www.romankagan.com/?p=118
If after this you still can't connect, verify that SQL Server ports are not been blocked by the machine firewall.