Network naming: no LDAP server detected or configured - c#

I am trying connect existing oracle database of existing project using asp.net. I have direct access to the oracle database.But for now I have created a simple table in the existing live oracle server and I am trying to connect to that server by creating a simple registration page in asp.net.
I am totally new into oracle and its configuration. I need to know the steps to connect my current asp.net application (login page and registration page). I am not using anything else other than visual studio 10 and oracle server (same error after trying to connect on local oracle server 11g)
The error message/exception i am getting is "Network naming: No LDAP server detected or configured"
What I have tried?
I have changed the connection string in the back end i.e the xyz.aspx.cs file, i have not made any changed in the web.config file.

I resolved this error by copying my ldap.ora (and other config files) over to where tns.ora file sits by default as described here:
if I select tns as connection type in Add Connection dialog box that's
when I come to know about tns file's default location.

I had the same problem with vs.net 2019.
Error when creating db. conn. in IDE: Network naming: no LDAP server detected or configured. I resolved it by removing LDAP from sqlnet.ora file, from NAMES.DIRECTORY_PATH param.

Related

C# - Named Pipes Provider, Error: 40 - local access

I developed a windows application on another system, SQL Server was located somewhere on another server, standard instance, data access was not a problem at all.
Now I have to do some work on the application on my own system, where I have a Standard SQL Server on the same machine and an identical copy of the database. The database is perfectly accessible from the outside, testing the connectionstring from C# succeeds. I tried access using my windows user as well as SQL authentication using sa and its password. All test succeed, but when I try to run the application it fails giving the error message:
...Named Pipes Provider, Error: 40..
I am using SQL Server 2019, standard port, all protocols activated. The users I tried are sysadmins (since I only want to make some modifications to my application, security is not important at the moment).
It looks as if I had no local access to my database from a C# application - I am using Office 365. Any idea what I can do to make my application work locally?
Thanks so much!
Check this troubleshooting guide from MS even when it says it's for connecting to instances on a different host.
If you already validated that all protocols are enabled, you should check the connection string you're using. You can try the following:
Specifying localhost or the host name will use shared memory so you shouldn't get any error related to named pipes.
Use the pipe path (you can find it in the SQL Server Configuration Manager - > SQL Server Network Configuration -> Protocols for -> Named Pipes -> Properties -> Pipe Name
Use the IP of the host and specify the port number (1433 if it's the default one)

How to deploy a windows forms database application

I am developing a windows forms application that needs to communicate with the SQL Server. I'm facing a problem when I deploy the application once the connection string is trying to connect to an invalid address.
I've already searched a lot and I found out the connection string must have the |DataDirectory| directive. Now the .mdf file is located on the directory C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA. Actually the connection string is:connectionString="Server=.\SQLExpress;AttachDbFilename=|DataDirectory|PDVDatabase.mdf;Database=PDVDATABASE;Trusted_Connection=Yes;"
The only way my app connects to the database is by the Server Explorer (I'm using Visual Studio 2013) where I get the static connection string of the .mdf file I set up in the app.config, but that way won't work after the deployment.
My question is: How do I do to connect my app after the deployment in order to communicate with the .mdf file? (I'm using a setup project for deployment). What's can be wrong?
Thanks.
A lot of things need to be addressed
1) You need a copy of your MDF and LDF files to be distributed with your app
2) You need to know if your user has Sql Server installed in its internal LAN or its PC
If the previous condition is true then
3.1) You need to attach your copy to the end user Sql Server Instance
3.2) You need to change your connection string to point to the end user Sql Server Instance
else
4.1) You need to distribute and install LOCALDB
4.1) You need to prepare the connection string for LOCALDB
Some links to help you in this task
To Attach and Detach a database information
For LOCALDB information
Connectionstring for LocalDb
Find Sql Server Instances Across your network
You should put the connection string into App.config file of your application. There is a section meant for that in the config file.
<connectionStrings>
<add name="Connection String name" connectionString="..."/>
</connectionStrings>
That gives you a flexibility to change the config file after during the deployment of your application to make sure that the connection string points at the database in the user environment.
Later you can fetch the connection string in your C# code from the System.Configuration.ConfigurationManager.ConnectionStrings collection.
Read on the internet on how to write different connection strings, ex here: http://www.connectionstrings.com/ and you should be able to write a correct connection string to the database.
Maybe your troubles are caused by incorrect users and permissions setup in the database. You have to be sure, that the user, that is using your application after deployment, has right to connect and work on the database

Access ASP.NET with database running on localhost through LAN

I am using Microsoft Visual Studio 2013 Ultimate.
I have one C# application connected with WSN to collect and save all sensor readings in database. It is working fine and stable.
Later I decided to add ASP.NET application (developed in the same software) so other computers in LAN can access my page and check measurements. I have one web form with few labels and buttons to ensure move forward and backward through the database table. It is working fine when I start it from Visual Studio but when I am trying to access from IIS it does not work.
I have this error (main part of the text):
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
I have installed IIS and I can access "localhost" from my browser (IIS image appears). I published site with "Publish" option from Visual Studio.
I saw a few very similar questions on this forum but I did not find answer. Can you recognize what can be the problem?
Regards.
I think DeanOC's answer will apply if you are using your windows login to connect to sql server (in connection string you'll have Integrated Security=true) in which case:
In IIS select you web application on the righ side click Advanced Settings a dialogue box will pop up in it you can see which application pool your website is using
Close dialog go to Application Pools, right click the application pool you want and go advanced settings
Change the Identity of the application pool, under Process Model, to your current windows login.
http://www.codeproject.com/Articles/674930/Configuring-IIS-ASP-NET-and-SQL-Server
Everything is well explained. Just follow the procedure and it will be - Yeah, solved. :)
The message implies that either sql server instance you are pointing to is not running or that you are pointing to the wrong sql server instance. If you are able to run the application from visual studio then sql server should be running and that would imply that your connection string is wrong.
During publish, msbuild will run config transforms i.e. if build profile is set to release it will change the connection strings in web.config to those in web.release.config. Check your connection strings in the IIS website and also check you password is correct
You could enable TCP/IP in SQL Server Configuration.
Microsoft SQL Server xxx -> Configuration Tools -> SQL Server Configuration Manager -> Select TCP/IP. Right click and select enable
Therefore, you can connect successfully from your local computer but it fails when you access from IIS of other server.
I think you are trying to access the web page from another computer in the network and not sql server in which case you have to add a binding to your site. By default the site is only bound to localhost port 80 meaning it will only be accessible from within the same machine. You'll need a url with dns entries or a static ip address to use to connect to your machine. Check out IIS bindings:
http://blogs.technet.com/b/chrad/archive/2010/01/24/understanding-iis-bindings-websites-virtual-directories-and-lastly-application-pools.aspx
http://technet.microsoft.com/en-us/library/cc731692(v=ws.10).aspx
because you used attach Mode in this way when one of them is connected to your database other one cannot use it like open file. and only the one who is in the same sever could access to your database.
to solve this problem you have to add your database to your SOL server manager after that you could access to it from many devices use
this connection string
Data Source='server IP';Initial Catalog='database name';Persist Security Info=True;User ID='your user name';password='your password'
please follow this video
enter link description here

Provider named pipes provider error 40 could not open a connection to SQL Server error 2 [duplicate]

This question already has answers here:
How do I fix the error 'Named Pipes Provider, error 40 - Could not open a connection to' SQL Server'?
(33 answers)
Closed 3 years ago.
When I am trying to connect to my database in SQL Server Management Studio, I getting this error:
Provider named pipes provider error 40 could not open a connection to SQL Server error
After checking several answers on SO, I opened the SQL Server Configuration Manager
I found SQLSERVER (SQLEXPRESS) and all three options state >> STOPPED
I tried it starting by right clicking on it, but i got below error:
The request failed or the service did not respond in a timely fashion
How can I connect to the instance???
Well I have an easy solution for your question. Follow the steps:
Go to SQL Server Configuration manager
SQL Server Network Configuration:
Protocol for MSSQLSERVER
In the right pane split page you will have to disable VIA as follows
Shared Memory - Enable
Named Pipes - Enable
TCP/IP - Enable
VIA - Disable
Search for services in control panel,
there you will find and entry View Local Services in Admin tool section
select it that will show a window with all services in your system,
find your service SQLEXPRESS and click on Start. It should start your server instance :)
In Sql Server Configuration Manager program, start SQL SERVER, enable the TCP/IP connection. After, allow the port in the firewall to be sure that's ok.
It's a generic error so it can be a lot of things. I got this error once and when I added port number (1433) to my connection string everything started to work again.
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=Server,1433;Initial Catalog=Test;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
</connectionStrings>
I have provided steps to fix your issue Provider named pipes provider error 40 could not open a connection to SQL Server error as below:
Confirm for working fine SQL Server Services services.
Confirm for working fine SQL Server (MSSQLSERVER).
Confirm for working fine SQL Server Browser.
Delete all your previous Aliases and now create new aliases as per your requirements.
Now assign your SQL Server Default Port 1433
Now click on Client Protocols in instance, click on TCP/IP in right pane, now click on mouse right click, open Property, here you can check for your default port of SQL 1433
Run your SQL Server Management Studio, then right click, click on property option and then click on Connections on tab, now check for Allow remote Connections to this server.
Confirm for Ping IP Host or not
Check for your Firewall setting not to blocking your SQL Server port
In my case, this was the solution.
I found out that I could connect using localhost**instancename**
So I uninstalled Database Engine component only.
Then I ran SQL Server installer and this time chose default instance option whereas before I had named the instance the same as my machine.
Now I can connect using localhost(which is setup in several application config files so I needed to still connect like this).
In my case, first I'm inserting/viewing/deleting data in my local SQL Server. Then at some point in development, the client wants to up the system(Windows Forms) in the server (network) so I've face to this kind of problem, what I check is the likes of this.viewEmployeeTableAdapter i delete that because it is still connected to the local db. I notice that because in my PC. The system is working properly whilst when im transferring it to other PC the
Provider named pipes provider error 40 could not open a connection to
SQL Server error
is appearing. So it's because I have a sql connection opening MY SQL Server while the other PC doesnt have.
This error has caused been popping up for me since installing .net 4.7 I had to alter my connection string to include TransparentNetworkIPResolution=False;
Server=server;Database=dbname;Uid=user;Pwd=pword;TransparentNetworkIPResolution=False;
Best idea is uninstall SQL and again Install SQL, Clear all temp files first and restart after that install. give a proper name to instance at a time of install.

MVC4 published application account logon page does not load

I have created an MVC 4 application using the standard Internet Application template.
I have added some other controllers, views, model and a connection to my own sql database which is working correctly.
When i publish this to a file location to access via my IIS8 on my windows 2012 server the application works except for when i click on logon or register links.
I have not made any changes to the registration or logon parts of the application and as such the Account controller and model have remained the same as has the DefaultConnection string in the webconfig file see below
enter <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-mvcdev-20131010105728;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-mvcdev-20131010105728.mdf" providerName="System.Data.SqlClient" />
I have a couple of registered members and have some views and controllers that require an authorised user to run correctly.
The error i get when i try to access the Account/Logon or Account/Register is:-
Server Error in '/' Application.
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 50 - Local Database Runtime error occurred.
Cannot create an automatic instance. See the Windows Application event
log for error details. )
The 2 event logs are
Unexpected error occurred while trying to access the LocalDB instance registry configuration. See the Windows Application event log for error details.
and
Cannot get a local application data path. Most probably a user profile is not loaded. If LocalDB is executed under IIS, make sure that profile loading is enabled for the current user.
Has anyone else come across this or have any links to some helpful resolutions?
The application was published to a folder in the Public Documents of my windows server and is being accessed currently of machines on the same LAN
I was also suffering from same problem but there is so small solution for it
just go in iis server than to application pool from which you application is running and in advance setting of application pool we will get the option of Process Model under which there is identity which is by default application pool identity just change it to Local System and your done
And Remember to Put App_Data Folder their in WWW folder of IIS server
If you used the Internet Template for MVC 4 it uses SimpleMembership as the membership provider and automatically wires it up. If you did not make any changes to the basic configuration SimpleMembership is configured in the web.config to use a local database (localDB). SimpleMembership uses EF code-first with lazy initialization. So it checks if the database is available the first time you try to access any of its methods, such logon and registration. If the database is not available it tries to create it. These error messages probably indicate that it could not create this database. If I had to guess you do not have the proper privileges on the server you are deploying to to create a localDB. It is trying to create it in the App_Data folder. Check to make sure that the application has privileges to create files in this folder. The better solution for a production application is to use SQL Server and just change your connections string to point to it instead.

Categories