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 9174063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:41:36+00:00 2026-06-17T16:41:36+00:00

Client’s App.config : <?xml version=1.0 encoding=utf-8 ?> <configuration> <system.serviceModel> <bindings> <wsHttpBinding> <binding name=WSHttpBinding_INewsletterService> <security

  • 0

Client’s App.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_INewsletterService">
                    <security mode="Message">
                        <message clientCredentialType="UserName" />
                    </security>
                </binding>
            </wsHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://127.0.0.1:8001/NewsletterService.svc/username"
                      binding="wsHttpBinding"
                      bindingConfiguration="WSHttpBinding_INewsletterService"
                      behaviorConfiguration="ClientCertificateBehavior"
                      contract="NewsletterServiceReference.INewsletterService"
                      name="WSHttpBinding_INewsletterService">
              <identity>
                <dns value="Newsletter"/>
              </identity>
            </endpoint>
        </client>
      <behaviors>
        <endpointBehaviors>
          <behavior name="ClientCertificateBehavior">
            <clientCredentials>
              <serviceCertificate>
                <authentication certificateValidationMode="PeerOrChainTrust"/>
              </serviceCertificate>
            </clientCredentials>
          </behavior>
        </endpointBehaviors>
      </behaviors>

    </system.serviceModel>
</configuration>

Host’s Web.config:

<?xml version="1.0"?>
<configuration>
  <connectionStrings>
    <add name="NewsletterEntities" connectionString="metadata=res://*/NewsletterDAL_EF.csdl|res://*/NewsletterDAL_EF.ssdl|res://*/NewsletterDAL_EF.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=(local)\SQLEXPRESS;Initial Catalog=Newsletter;Integrated Security=True;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient"/>
  </connectionStrings>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <services>
      <service name="WCFHost.NewsletterService"
               behaviorConfiguration="NewsletterServiceBehavior">
        <endpoint address="username"
                  binding="wsHttpBinding"
                  contract="WCFHost.INewsletterService"
                  bindingConfiguration="Binding">
          <identity>
            <dns value="Newsletter"/>
          </identity>

        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8001/WcfServiceLibrary/service" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="Binding">
          <security mode="Message">
            <message clientCredentialType="UserName"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="NewsletterServiceBehavior">
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom"
                                    customUserNamePasswordValidatorType="WCFHost.CustomUserNameValidator, WCFHost"/>
            <serviceCertificate findValue="Newsletter" storeLocation="LocalMachine" storeName="TrustedPeople" x509FindType="FindBySubjectName"/>
          </serviceCredentials>
          <serviceMetadata httpGetEnabled="true"/>
        </behavior>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>

CustomUserNameValidator.cs:

using System;
using System.IdentityModel.Selectors;
using System.ServiceModel;

namespace WCFHost
{
    public class CustomUserNameValidator : UserNamePasswordValidator
    {
        public override void Validate(string userName, string password)
        {
            if (null == userName || null == password)
            {
                throw new ArgumentNullException();
            }

            if (!(userName == "username" && password == "password"))
            {
                throw new FaultException("Unknown Username or Incorrect Password");
            }
        }
    }
}

MainWindow.xaml.cs:

using Newsletter.Common;
using Newsletter.UI.NewsletterServiceReference;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;

namespace Newsletter.UI
{
    public partial class MainWindow : Window
    {
        private List<MessageDTO> _messages;
        private List<RecipientDTO> _recipients;
        private NewsletterServiceClient _client;

        public MainWindow()
        {
            InitializeComponent();
            _recipients = new List<RecipientDTO>();
            _client = new NewsletterServiceClient();
            _client.ClientCredentials.UserName.UserName = "username";
            _client.ClientCredentials.UserName.Password = "password";
        }

        [...]

        private async void MainWindowLoadedAsync(object sender, RoutedEventArgs e)
        {
            await _client.AddMailingListAsync("All Recipients"); //Exception here
        }

        [...]
}

The exception I get:

System.ServiceModel.FaultException`1 was unhandled by user code
  HResult=-2146233087
  Message=The underlying provider failed on Open.
  Source=System.ServiceModel
  Action=http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher/fault
  StackTrace:
       at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
       at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass2.<CreateTask>b__1(IAsyncResult asyncResult)
       at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
       at Newsletter.UI.MainWindow.<MainWindowLoadedAsync>d__0.MoveNext() in c:\Users\Pawel\Dropbox\VS12_projects\Newsletter_2_new\Newsletter.UI\MainWindow.xaml.cs:line 43
  InnerException: 

What am I doing wrong?

UPDATE: InnerException message:

Cannot open database "Newsletter" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\.NET v4.5'.
  • 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-06-17T16:41:36+00:00Added an answer on June 17, 2026 at 4:41 pm

    To solve this problem I had to set the IIS AppPool as Database owner.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Client: string value = <?xml version=1.0?><person><firstname>john</firstname><lastname>smith</lastname> <person/>; using (HttpResponseMessage response = m_RestHttpClient.Post(new/customerxml/+value2, frm.CreateHttpContent())) {
Client Cache Configuration - <region name=test refid=PROXY> <region-attributes> <cache-listener> <class-name>com.test.cache.SimpleCacheListener</class-name> </cache-listener> </region-attributes> </region> For
Client wants a button on the mobile web app that launches a QR code
Client code is pretty simple: <form action=DDServlet method=post> <input type=text name=customerText> <select id=customer> <option
Any client js libraries for turning XML into a JavaScript object? I'm specifically working
Client Side: App.socket = io.connect('http://127.0.0.1:4000'); App.socket.on('draw', function(data) { console.log(drawing); return App.draw(data.x, data.y, data.type); });
Client will send me data in the form of XML and JSON and I
Client table contains first name, last name, email, and department. I need to compare
Client sends 50k customers in an xml file. I use Spring Batch's JaxBMarshaller and
My client has their domain name (lorem.com) registered with company X which also host

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.