WCF Error: Could not find default endpoint element that references contract 'IvSecurityAuthenticationPermissionService'

moondaddy 911 Reputation points
2021-02-10T08:28:18.857+00:00

Using VS 2019 and .net 4.8 and WPF, I’m setting up a new solution which was a copy of an existing solution that’s been working great for 7 years. We have frameworks with a lot of stuff including security, and WCF support so it’s easiest to copy a solutions that’s working good, then delete all the things we don’t need. I have done this many times with no problem. When I try to run this solution one of the first things it does is call this web service to load default permissions.
Server side all the code for this service is in a framework dll used in many apps and it always works. We also use svcutil.exe to generate the client side service code.
This is what’s in the app.config:

<endpoint address="http://localhost/LeadaRator.Web/WS/vSys/vSecurityServices/vSecurityAuthenticationPermissionService.svc"
binding="customBinding" bindingConfiguration="CustomBinding_IvSecurityAuthenticationPermissionService"
contract="IvSecurityAuthenticationPermissionService" name="CustomBinding_IvSecurityAuthenticationPermissionService" />

<binding name="CustomBinding_IvSecurityAuthenticationPermissionService">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>

and this is in the web.config

<binding name="VelocityService.vSecurityAuthenticationPermissionService.customBinding0">
<binaryMessageEncoding/>
<httpTransport/>
</binding>

<service name="VelocityService.vSecurityAuthenticationPermissionService">
<endpoint address="" binding="customBinding" bindingConfiguration="VelocityService.vSecurityAuthenticationPermissionService.customBinding0" contract="VelocityService.IvSecurityAuthenticationPermissionService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>

and this is what's in the file vSecurityAuthenticationPermissionService.svc.cs which pickups the framework code in another dll.

namespace VelocityService
{
    public class vSecurityAuthenticationPermissionService : vSecurityAuthenticationPermissionService_Extention
    { }
}

all of this code works exactly as-is in many other apps and the endpoint seems fine as I can browse it from the client and svcutil.exe uses the same url to generate the client side code with no problems. Here's the exception message:

System.InvalidOperationException
HResult=0x80131509
Message=Could not find default endpoint element that references contract 'IvSecurityAuthenticationPermissionService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
Source=System.ServiceModel
StackTrace:
at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
at System.ServiceModel.ChannelFactory1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress) at System.ServiceModel.ConfigurationEndpointTrait1.CreateSimplexFactory()
at System.ServiceModel.ConfigurationEndpointTrait1.CreateChannelFactory() at System.ServiceModel.ClientBase1.CreateChannelFactoryRef(EndpointTrait1 endpointTrait) at System.ServiceModel.ClientBase1.InitializeChannelFactoryRef()
at System.ServiceModel.ClientBase`1..ctor()
at ProxyWrapper.vSecurityAuthenticationPermissionService_ProxyWrapper..ctor()
at Velocity.UserSecurityContext..ctor() in D:\Apps\VSOCD\LeadaRator\Trunk\V01\vSecurityWinClient\PermissionApi.cs:line 129

This exception was originally thrown at this call stack:
[External Code]
Velocity.UserSecurityContext.UserSecurityContext() in PermissionApi.cs

Thanks for any help you can offer.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,388 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,178 questions
0 comments No comments
{count} votes

Accepted answer
  1. moondaddy 911 Reputation points
    2021-02-10T08:41:19.027+00:00

    Arrrr! Found the problem...

    In setting up the solution VS created a new app.config file. I keep the app.config in a folder so maybe when I changed the project name or something, VS created the new app.config because it didn't see it in the project root. Frustrating because I didn't ask it to and I have spent "hours" on this.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful