I have developed a test site in asp.net. While it is in running of the in built webserver it functions fine and am able to access the database (msde). But when i host it on IIS server on the same machine I get the following error whenever the site accesses the database:

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: 26 - Error Locating Server/Instance Specified)

How do I overcome this error.

The connection string in my web.config is as follows:

<connectionStrings>
        <add name="Cloud" providerName="System.Data.SqlClient" connectionString="server=naheed-pc1\mycloudflash;database=cloud;uid=sa;pwd=!cloud.123" />
    </connectionStrings>

Please assist.

hello.
it happen to me i think for long time ago,so what i can tell you that is sql security,go to sql server to security then you have NT AUTHORITY\NETWORK SERVICE then properties and go to user mapping,check your database name and choose a database role like public and try now.if it didn't work try NT AUTHORITY\SYSTEM and do the same thing.
really i can't remember,but at least i direct you.
hope this will help you.

Please check if you are able to connect using sql server management studio on the same name "naheed-pc1\mycloudflash" if not, then use the same name as shown in the sql server management studio

Hi all. thanks for your responses. I was finally able to resolve the problem by installing full sql version and using the tools to configure remote access to the database.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.