Recently I have created one website and hosted in my local IIS Server. When I try to open the website. It is showing an error like the one given
here . I think the reson behind this is I hosted the Website on Local IIS Server, and the database is residing on another machine. So how can I solve this isssue?
When I first created this , I faced some problem regarding ApplicationPoolIdentity . That issue I solved through in a
different thread.
Where is the database hosted on your local machine or on the same company's server that hosts your website? In either or neither case make sure that your database is accessible remotely. By the way what database are you using? If the database is accesible
then make sure that the server on which your website is hosted is not blocked by a wirewall or something.
Finally:
Go to your web.config file then for the customErrors tag then set attribute mode="Off". Update your hosted websites web.config with the modified one then browse to your website and post the error message that appears here. Knowing more about what is going
on will help us to better help you.
You need to grant access to 'NT AUTHORITY\NETWORK SERVICE' to your PERSONAL database.
Refference #2
"Mixed authentication" is not enabled by default when installing SQL Server. Check this in SQL Server Management Studio Express - right click server node, open properties, go to Security, enable "SQL Server and Windows Authentication mode".
Good Luck`
Sincerely,
Mahad Bin Mukhtar Remember to Mark the replies as Answers
The easiest day was 'yesterday'.
MCP, MCSD
For .NET TECH Blog
Thank you very much for your response. my database is hosted on a dedicated server for databases only. and my website is hosted on my local IIS machine. When I give connection string with "User ID=sa" and integrated security= false it
works fine, otherwise its showing an error the one
here . and in my Web.config file there is no <customErrors>.So, what may be the reason for this?
My web.config file content is given below
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="NorthwindConnectionString" connectionString="Data Source=sqlMachine;Initial Catalog=Northwind;Integrated Security=true; providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="false" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
</system.web>
</configuration>
For connecting to remote SQL databases (on SQL server) I would recommend using SQL Server Authetication. Contact the company that hosts your database then ask them to setup a username and password for you. Your connection string will then look like this:
Then for the custom errors place this tag inside the <system.web> element:
<customErrors mode="Off">
</customErrors>
Make sure that the code that connects to the database can throw the error. In other words, don't place it inside a try catch statement or throw the error again inside the catch statement.
salampv.07
Member
1 Points
9 Posts
How to host a website Locally without Error?
Nov 23, 2012 12:10 PM|LINK
Hello Asp.NET.
Recently I have created one website and hosted in my local IIS Server. When I try to open the website. It is showing an error like the one given here . I think the reson behind this is I hosted the Website on Local IIS Server, and the database is residing on another machine. So how can I solve this isssue?
When I first created this , I faced some problem regarding ApplicationPoolIdentity . That issue I solved through in a different thread.
Regards
Salam
everlearnin
Member
398 Points
82 Posts
Re: How to host a website Locally without Error?
Nov 23, 2012 03:04 PM|LINK
Where is the database hosted on your local machine or on the same company's server that hosts your website? In either or neither case make sure that your database is accessible remotely. By the way what database are you using? If the database is accesible then make sure that the server on which your website is hosted is not blocked by a wirewall or something.
Finally:
Go to your web.config file then for the customErrors tag then set attribute mode="Off". Update your hosted websites web.config with the modified one then browse to your website and post the error message that appears here. Knowing more about what is going on will help us to better help you.
MahadTECH
Star
8976 Points
1659 Posts
Re: How to host a website Locally without Error?
Nov 23, 2012 04:16 PM|LINK
Good Luck`
Mahad Bin Mukhtar
Remember to Mark the replies as Answers
The easiest day was 'yesterday'.
MCP, MCSD
For .NET TECH Blog
salampv.07
Member
1 Points
9 Posts
Re: How to host a website Locally without Error?
Nov 24, 2012 03:07 AM|LINK
Helo everlearnin,
Thank you very much for your response. my database is hosted on a dedicated server for databases only. and my website is hosted on my local IIS machine. When I give connection string with "User ID=sa" and integrated security= false it works fine, otherwise its showing an error the one here . and in my Web.config file there is no <customErrors>.So, what may be the reason for this?
My web.config file content is given below
<?xml version="1.0"?> <!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <connectionStrings> <add name="NorthwindConnectionString" connectionString="Data Source=sqlMachine;Initial Catalog=Northwind;Integrated Security=true; providerName="System.Data.SqlClient"/> </connectionStrings> <system.web> <compilation debug="false" targetFramework="4.5"/> <httpRuntime targetFramework="4.5"/> </system.web> </configuration>Could you please help me to solve this issue?
salampv.07
Member
1 Points
9 Posts
Re: How to host a website Locally without Error?
Nov 24, 2012 03:09 AM|LINK
Hello Mahad,
Thank you very much for the reply.
I tried both your suggestions. But the error is still there.
Is there anymore workarounds?
Regards
Salam
oned_gk
All-Star
31766 Points
6492 Posts
Re: How to host a website Locally without Error?
Nov 24, 2012 03:56 AM|LINK
try give full access to everyone your mdf file
everlearnin
Member
398 Points
82 Posts
Re: How to host a website Locally without Error?
Nov 24, 2012 04:16 AM|LINK
For connecting to remote SQL databases (on SQL server) I would recommend using SQL Server Authetication. Contact the company that hosts your database then ask them to setup a username and password for you. Your connection string will then look like this:
server=database.example.com; database=yourdb; uid=username; pwd=password;
Then for the custom errors place this tag inside the <system.web> element:
Make sure that the code that connects to the database can throw the error. In other words, don't place it inside a try catch statement or throw the error again inside the catch statement.
salampv.07
Member
1 Points
9 Posts
Re: How to host a website Locally without Error?
Nov 24, 2012 04:16 AM|LINK
Hello oned_gk,
Thank yo very much for the reply. How can I do this? using SQL Server Management studio? Could you please explain the steps?
Thanks and Regards
Salam