I tried to connect the database on my local machine. API throws exception "The underlying provider failed on Open". I checked the inner exception to find out more my fault.
The solution key is in your Web.config file. I use this configuration and it works.
<connectionStrings>
<add name="MyDBEntities" connectionString="metadata=res://*/DBAAA.csdl|res://*/DBAAA.ssdl|res://*/DBAAA.msl;provider=System.Data.SqlClient;
provider connection string="
data source=MyMachineDomainHQGWD2S\SQLEXPRESS;
initial catalog=My_DB_TEST;
integrated security=True;
MultipleActiveResultSets=True;
App=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>
Hope it can help :D
======================================================================
UPDATE
======================================================================
I've got the problem again! I want to add the strongly note that YOU CANNOT SET data source AS YOU LOCAL IP!! PLEASE SET IT TO $DOMAIN\$MACHINE_NAME
Then you can access the database with locahost:port/service or _your_ip:port/service
======================================================================
วันอาทิตย์ที่ 22 มกราคม พ.ศ. 2560
This site can’t be reached localhost refused to connect
I found this problem when I started debugging web service on VS2015. Refer to the answer http://stackoverflow.com/a/35418904/6879961, I added a step before following them.
I deleted .vs\config\applicationhost.config and then I create the virtual directory. This action will generate the new applicationhost.config for you with the correct URL.

* this image is from stackoverflow
I deleted .vs\config\applicationhost.config and then I create the virtual directory. This action will generate the new applicationhost.config for you with the correct URL.

* this image is from stackoverflow
สมัครสมาชิก:
บทความ (Atom)
