To develop and deply the web service on IIS. In case your service have to connect to SQL server on the local machine. Please follow these steps.
1. Setting SQL server to allow log in by user and Windows authentication
- Open SQL Server Management Studio & log in with Windows Authentication
- On "Object Explorer", right click on the SQL Server and click "Properties"
- On "Security" tab, section "Server authentication" select "SQL Server and Windows Authentication mode"
- Click OK
2. Restart SQL Server
- Command line "Services"
- Find "SQL Server [SQLEXPRESS]"
- Right click and select "Restart"
3. Create log in user for SQL Server authentication
- Open SQL Server Management Studio & log in
- On "Object Explorer", expand the "Security"
- Right click on "Logins", select "New Login..."
- Enter login name and setting password
- On "User Mapping", check the target database
- Click OK
4. Set Web.config
- Use this configuration
<connectionStrings>
<add name="[YourPreferDatabaseConfigName]" connectionString="Data Source=[Domain]\SQLEXPRESS;Initial Catalog=[Database];Password=[password];User ID=[username];" providerName="System.Data.SqlClient" />
</connectionStrings>
....Everything will be alright....
Thanks for
- https://msdn.microsoft.com/en-us/library/bb986870.aspx
- https://msdn.microsoft.com/en-us/library/aa337562(v=sql.105).aspx
- https://stackoverflow.com/questions/20923015/login-to-microsoft-sql-server-error-18456
- https://stackoverflow.com/questions/27387912/keyword-not-supported-provider-opening-sqlconnection