SQL does not work on another device after publishing to the web

Asked

Viewed 168 times

2

Because my page cannot run queries to the bank when it is published on the web and being used from other devices (computers and smartphone networked)?

If I use it from the computer itself (server), I can access it normally. It would be some SQL server configuration that is blocking access?

The server runs on Windows 7 (IIS 7) SQL Server 2008 RC2

connectionStrings: 
name="conexao" connectionString="server=192.168.1.110\\DIEGO-PC,1433;;database=corretor;Integrated Security=True;"

Remembering that all devices are on the same network.

  • 1

    @Lucasnunes, please don’t use código for given names (SQL). Batsticks should be used only for code and similar (filename, paths, Urls).

  • @Ok! It won’t happen again.

  • When you say "published on the web," you mean IIS is on an external server, and you want it to access your local SQL Server? Your connection setting only works if IIS and SQL are on the same network.

  • No, the ISS is on my machine anyway. And all the devices that are accessing it are on the same network. However only the server itself can access all the functions that need access to the bank.

  • What error does it make? Sure it is SQL?

1 answer

0


First of all, it is generally not good practice to give direct access to the database on a mobile phone unless you have a very peculiar problem to solve. The ideal is usually that the mobile accesses a service on the network. This service would be hosted on a server with access to the database.

Other than that - you’re using the integrated security of Windows (Integrated Security=True;). There is a very high probability (I would say 99,999 and a few nine percent more chance) that the user logged in to your mobile is not the same user logged in to the PC. I would even say that if it’s an iPhone, you’re logged in with an Apple account, and if it’s Android, the user logs in to Google, Facebook, or some other identity provider.

If you really want to log into the database with your phone (and I repeat that this is generally not recommended), you need to use another security scheme, such as one that asks for a username and password. You need to configure the database to accept authentication other than the one integrated with Windows, and you need to pass the username and password in the connection string.

Also make sure that your phone can reach the server over the network. Even though you are on the same network, the connection can be denied due to your settings (i.e.: firewall blocking port 1433 - your PC may not have this problem because it is the server itself - cellular not part of the domain/workgroup etc.).

  • I think I got it wrong. It is not that I want to give the bank access to my "Iphone", but when accessing the published site I can access all functions of my site, such as login, searches and data insertions. However I will make sure to change the access mode to the bank, now including Login and Password. Otherwise I have already done, free doors, etc... When I have the result I warn you. Thank you.

  • It worked. I removed "Integrated Security=True;" and put a User Id and Password in the string Connection. Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.