• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 375
  • Last Modified:

Web.configh Connection String to Local Nework Server

Hi,
I currently have my aspx files stored on a web server with 2008 ms sql. I have no problem connecting to the ms sql on the web server using a connectstring in my web.config. My company also has a local network 2008 ms sql where I need to retrieve some data. Is it possible to create a connection string in my web.config file on the web server to connect me to my company's local network server? I understand that remote users will not have access to this data. Any help or insight would be appreciated!
0
pcareWI
Asked:
pcareWI
  • 3
  • 2
  • 2
3 Solutions
 
käµfm³d 👽Commented:
As long as there are no hardware (e.g. firewall) or software (e.g. permissions) restrictions to your application reaching the server, then you can connect to your database server wherever it resides if it is connected to a reachable network. Review the connection strings for SQL Server to determine which one makes the most sense for your environment.
0
 
unknown_routineCommented:
Yes it is qutie possible. In our company our web.config containts entries for 3 SQL Server Machines (none of them are on webserver)"



The main point is since you do not want to give every user of your web app permit to use the SQl Server. You need to use a generic user and Passord  Within your ASPX code(put this inof in the config file) . For example MyLogin and MyPassword and pass this info to the connectionctring when connecting to the SQL server.

Before the above you have to ASK the Sql Server Admin to provide admin rights on the proper databases on the SQl Server to this generic user(MyLogin).
0
 
pcareWIAuthor Commented:
I use the connection string below to access the local network server in my testing environment which is local as well and the connection works fine. But when I load the web.config file to the web server, I get an error which is specified below.

Connection string: <add name="TestConnectionString" connectionString="Data Source=APOLLO\MSSQLSERVER2008;Initial Catalog=AppData;User ID=Testuser; Password=user"
providerName="System.Data.SqlClient" />

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: 26 - Error Locating Server/Instance Specified)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
käµfm³d 👽Commented:
Can the web server "see" the APOLLO server? You may need to confirm with your network staff and/or server admins.
0
 
pcareWIAuthor Commented:
Hi unknown_routine,
I will request that my sql server admin provide admin rights to the generic user. Do you have an example of your connectionstring that you use?

kaufmed,
I will confirm with my admin if my webserver can see apollo.
Thanks,
0
 
unknown_routineCommented:
Here is one Server in our web config:

<!--***** DEVELOPMENT DataBase*****-->
<configuration>
<appSetting>      
      <add key="MyLogin" value="Provider=SQLOLEDB;Data Source=177.xxx.xxx.88;User ID=MyLogin;Password=MyPassword;Initial Catalog=MyDatabase;Workstation ID=A
BC_001;Command timeout=24000"/>



We have similar entries also for QA and productions databases.
0
 
unknown_routineCommented:
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.


In your case ASk the SQl Server Admin what  the ip address of the local SQL server(APOLLO) is. Then from the Webserver machine try to ping it. If you can't, you need to contact your  network admin to make that possible.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now