2
Answers

why we need to copy constring from dll in to web project

Photo of Mayank

Mayank

8y
171
1
  1. I have created a dll.
  2. I have added a entity model in to above dll.
  3. Connection string generated in appconfig of dll  for entity model.
  4. Then created new project in solution which is web application.
  5. Add a reference of dll in web application.
  6. Add a new webpage in web app and call a entity model to get data from DB.
  7. I found error no connection string found.
  8. When I copy connection string from appconfig of DLL in to wecbconfig of webapplication then error is removed.
I just want to know why I need to copy connection string in to web config whereas I have already added a reference of dll in web project.

Answers (2)

0
Photo of Mayank
NA 554 2.6k 8y
Hi Ramesh,
 
I think when we add a reference of DLL then completed code should be included in the project.
I am not sure but I need a complete discription why we need to copy settings in to webconfig from dll? 
0
Photo of Ramesh Palanivel
NA 9.5k 138.7k 8y
Hi mayak,
 
In your web application , it will first search the connection string in your page, if it found it will take the connection string and will process it. If it is not found, it will goes to your web.config to search your connection string.It won't search the connection string in you added Dll. I am not sure it correct or not!.. But it won't I think.
 
The connection string should be present in webconfig if your application is web application