Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 601971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:46:21+00:00 2026-05-13T16:46:21+00:00

I’m writing a WCF service in Visual Studio 2008 to be hosted on a

  • 0

I’m writing a WCF service in Visual Studio 2008 to be hosted on a Windows 2008 Standard server.

I’ve created a new Web Site in IIS7 with its own application targeted to ASP.NET 2.0. I added .NET 3.0 Framework features to the server role. I’ve already gone through all of the steps involving *.svc extensions and the aspnet_isapi module. I’ve run “ServiceModelReg -r” and restarted IIS as well as the server itself.

My project targets the .NET framework 3.5 for builds. My solution references the project as a Web site using a UNC path to the server’s Web directory. The project builds without errors and I can successfully add a service reference to my WCF service in my client project (on my Win XP development virtual machine). My client project builds and runs, but throws an exception during the service method (CheckDatabaseConnection) call. My web.config and service classes are attached below, followed by the client app. I’ve completely run out of ideas!

web.config:

    <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" />
    <services>
        <service behaviorConfiguration="ConnectivityBehavior" name="EDCO.Web.Services.Connectivity">
            <endpoint address="http://validurl.net" binding="wsHttpBinding" contract="EDCO.Web.Services.IConnectivity">
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="ConnectivityBehavior">
                <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
</system.serviceModel>

IConnectivity.cs:

    [ServiceContract(Namespace="http://validurl.net")]
public interface IConnectivity
{
    #region Methods

    [WebGet()]
    [WebInvoke(Method="GET")]
    [OperationContract()]
    bool CheckDatabaseConnection(string server, string database, string user, string password);

    #endregion Methods
} // interface IConnectivity

Connectivity.svc.cs:

    public class Connectivity : IConnectivity
{
    #region Members

    const string CONN_STRING = "Server={0};Database={1};User ID={2};Password={3};";

    #endregion Members

    #region Methods

    public bool CheckDatabaseConnection(string server, string database, string user, string password)
    {
        SqlConnection conn = null;

        try
        {
            conn = new SqlConnection(string.Format(CONN_STRING, server, database, user, password));
            conn.Open();
        }
        catch
        {
            return false;
        }
        finally
        {
            if (conn != null)
            {
                if (conn.State != ConnectionState.Closed)
                {
                    conn.Close();
                }
                conn.Dispose();
            }
        }

        return true;
    } // CheckDatabaseConnection(server, database, user, password)

    #endregion Methods
} // class Connectivity

client Program.cs:

    class Program
{
    #region Methods

    static void Main(string[] args)
    {

        Connectivity.ConnectivityClient connect = new Connectivity.ConnectivityClient();

        Console.WriteLine("Establishing connection...");
        if (connect.CheckDatabaseConnection("dbServer", "dbName", "login", "password"))
        {
            Console.WriteLine("Successful connection!");
        }
        else
        {
            Console.WriteLine("Connection failed.");
        }
        Console.ReadLine();
    } // Main()

    #endregion Methods
} // class Program
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:46:21+00:00Added an answer on May 13, 2026 at 4:46 pm

    OK, it looks like I solved the problem by adding an identity element to my web.config. Oddly enough, this hasn’t been one of the answers floating around on the Internet but I stumbled across it while looking at a nearly-unrelated article. The fix goes like this:

            <service behaviorConfiguration="ConnectivityBehavior" name="EDCO.Web.Services.Connectivity">
                <endpoint address="http://validurl.net/Connectivity.svc" binding="wsHttpBinding" contract="EDCO.Web.Services.IConnectivity">
                    <identity>
                        <dns value="validurl.net" />
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
            </service>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.