Reasons "network path not found" in ASP.NET MVC

I made an ASP.NET MVC web application, uploaded the files as well as the database, but when I view it I get the following error.

Network path not found

I am using Entity Framework and this is the connection string in my web.config file

<connectionStrings> <add name="[mydatabase]Entities" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=sql.[somedomain].net;initial catalog=[mydatabase name];User ID=[myUsername];Password=[myPassword];MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> </connectionStrings> 

I have downloaded many websites using an IP address , for example. xxx.xxx.x.xxx as a data source, but this is the first time a server name is used, for example. sql. [somedomain] .net -I can't get the ip- server, so I'm not sure if this caused an error, or if I have to do something special to make it work.

So, I ask if there is something that I have to do in order to use the server name as a data source, if not, what else might cause this error.

This answer really does not help.

Thanks in advance.

Update

If I ping sql server. [somedomain] .net, I get this result

Ping request could not find sql host. [somedomain] .net. Check the name and try again.

And if I nslookup this, I get this result

*** Unknown cannot find sql. [somedomain] .net: non-existent domain

This means that the server is unavailable. And is there anything I can do by contacting hosting technical support?

solvable

This is an error / incorrect configuration of the hosting provider. After 3 days of searching and contacting customer support, they realized that this was their problem. I leave this question to tell future Host Only viewers with reliable / well-known hosting providers no matter what .

+4
source share
2 answers

The information you received from technical support seems rather contradictory. Usually, you can disable remote access for database servers, but if so, using a domain to connect does not really help you.

If you are trying to connect to this database from a published MVC project while being with the same provider that supplies your database, then you should not have connection problems, since you are no longer "remote". However, if your DNS is also not hosted by the same provider, using a domain may result in the connection being displayed remotely as it goes outside to return. The safest bet is simply to use the IP address of the database server in the connection string.

Also pay attention to the IP address that you have for the database server. If it is in the range of 10. * or 172. *, this is the local IP address, but if it is something else, it is most likely an external IP address. Attempting to connect to such an address may also result in the connection being displayed as remote, since you are going outside the network to return. In addition, if you prohibit remote access to the database server, it is a good idea, you can generally safely allow remote access to specific IP addresses. You most likely have no control over this directly, but you can check with your provider if he can add an explicit rule for your IP address of the web server, so even if the connection is remote, it will still work .

As for working in local development mode, you just need to use the local database. You may already have this, but your question was not entirely clear in this aspect.

+1
source

I also ran into the same problem. I used a slash instead of a backslash for the instance name (clustername \ instancename). As soon as I replaced him on his back. It worked fine.

0
source

All Articles