none
Could not find default endpoint... Only in designer view, but still runs OK. RRS feed

  • Question

  • We have a WPF app where one of the user controls references a web service which gives us this exception only at design time.  Furthermore, it only occurs when this user control is nested in another user control (both user controls from the same assembly).  However, when I new this user control at design time when it's not nested in another control, I don't get this exception.  Below is a screenshot of the user control, "ucSurveyMapList", in the designer when its not nested in another control:

    and here's a screenshot of "ucSurveyMapList" when it is nested in another user control:

    and here's the exception giving us a bad time:

    >>

     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.

    <<

    Here's the situation:

    1) "ucSurveyMapList" is in an assembly called UIControls.

    2) "ucSurveyMapList" calls a method "GetArtifactPermissions()" in another assembly to get a list of permissions.  This assembly is "vSecurityWinClient".

    3) "GetArtifactPermissions()" calls a web service method from a 3rd assembly.  this web service is called:

    IvSecurityAuthenticationPermissionService

    which is mentioned in the exception listed above.

    4) "IvSecurityAuthenticationPermissionService" is properly listed in the application's App.config file located in the application's main startup project.

    <binding name="CustomBinding_IvSecurityAuthenticationPermissionService">
      <binaryMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
          maxSessionSize="2048">
        <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      </binaryMessageEncoding>
      <httpTransport manualAddressing="false" maxBufferPoolSize="2147483647"
          maxReceivedMessageSize="2147483647" allowCookies="false" authenticationScheme="Anonymous"
          bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          keepAliveEnabled="true" maxBufferSize="2147483647" proxyAuthenticationScheme="Anonymous"
          realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
          useDefaultWebProxy="true" />
    </binding>

    and 

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

    This is listed along with 100+ other services and all run fine.

    So why in this particular instance are we getting the exception which crashes the designer?

    By the way, the method listed above, "GetArtifactPermissions()", is not called from a constructor.

    Thank you for any help you can offer!

    Thursday, August 24, 2017 5:21 AM

Answers

  • Hi moondaddy,

    Thanks for your project, and I could reproduce your issue.

    In my option, it is related with VS designer.

    For a workaround, I suggest you follow below steps.

    1. Change ucMap.xaml.cs like below:

    public partial class ucMap : UserControl
        {
            #region Initialize Variables
            ProxyWrapper.vMapServiceService_ProxyWrapper _v_MapServiceProxy = null;
            #endregion Initialize Variables
            public ucMap()
            {
                InitializeComponent();
            }
            public  void Init()
            {
                _v_MapServiceProxy = new ProxyWrapper.vMapServiceService_ProxyWrapper();
                _v_MapServiceProxy.GetMapSericeMetaDataByProjectCompleted += _proxy_GetMapSericeMetaDataByProjectCompleted;
                _v_MapServiceProxy.Begin_GetMapSericeMetaDataByProject(new Guid());
            }
    
            void _proxy_GetMapSericeMetaDataByProjectCompleted(object sender, GetMapSericeMetaDataByProjectCompletedEventArgs e)
            {
                    byte[] array = e.Result;
                    object[] data = Serialization.SilverlightSerializer.Deserialize(array) as object[];
                    string result = data[0] as string;
                    MessageBox.Show(result, "", MessageBoxButton.OK);
            }       
        }

    2. Change MainWindow.xaml XAML like below:

    <vMsMngr:ucMap x:Name="ucMap" Grid.Column="1" Grid.Row="1"/>

    3.Change MainWindow.xaml.cs like below:

        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
                ucMap.Init();
            } 
        }

    And I could get “The Service Works!” alert after running the project.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by moondaddy Tuesday, September 5, 2017 8:03 PM
    Tuesday, September 5, 2017 7:33 AM

All replies

  • Hi moondaddy,

    How did you combine UserControl with web service?

    Could you share us detail steps to reproduce your issue like creating web service, creating UIControl and then add UIControl to WPF project.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, August 24, 2017 6:51 AM
  • Hi Edward,

    I did not combine a user control and a web service. 

    We are talking about 4 projects here (not counting anything server side).  The main WPF app being project 1 contains this user control (which lives in project 2) calls a method in project 3.  That method calls a web service method in project 4.  That's it.

    All service bindings and endpoints for the entire application (over 100 projects) are located in a single App.config file in the main wpf project.  I know some people have had exceptions "could not find binding..." because the end points were located in different app.config files in different projects.  that's not the case here.  

    Because I have many projects and many services and all seem to work fine except for this one at design time, I don't know how I could possible reproduce this in a sample solution.  I work with many solutions and this only occurs here.

    Thank you

    Thursday, August 24, 2017 12:30 PM
  • Hi moondaddy,

    As you know, the error message indicates that the configuration could not be found, and it seems your issue is related with specific scenario like nested user control. It is difficult for us to provide helpful suggestion without reproducing this issue.

    I only could provide general suggestion per to your description.

    1. Check whether the endpoint exists in the Project 1

    2. Do you mean a new user control works, but the user control nested in another control will fail?

    3. In addition, it is hard to understand this exception happens at design time. As my experience, this error happens on runtime.

    Could you follow bellow steps to check whether it will be reproduced?

    1. Create a simple web service in Project A

    2. Create a Project B which seems to be a library to call web service (the project type depends on your scenario).

    3. Create the Project C which will create the user control

    4. Create the Project D which will use the user control in project C.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, August 25, 2017 5:41 AM
  • OK, I have reproduced this problem in a small solution.  this time I had the same issue but in a different solution and a different webservice.  I removed all other projects and code from the solution so it's practically empty.  Below is a screenshot of the designer.

    and here's the exception from the blue squiggly:

    Severity Code Description Project File Line Suppression State
    Error  Could not find default endpoint element that references contract 'vMapServiceService' 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. WPFMapPrototype D:\Apps\Pipeline\WPFMap\WPFMapPrototype\WPFMapPrototype\MainWindow.xaml 27

    I have saved the solution to a shared drive on OneDrive so you can take a look for yourself.  I hope it still reproduces the same issue on your machine.

    Thanks in advance for taking a look at this!!!

    Sample Solution

    Sunday, September 3, 2017 4:05 AM
  • Hi moondaddy,

    I have downloaded your project, but I got below error while building it under VS 2015.

    Severity	Code	Description	Project	File	Line	Suppression State
    Error		Unable to resolve type 'Infragistics.Controls.Interactions.XamDialogWindow, InfragisticsWPF4.Controls.Interactions.XamDialogWindow.v17.1, Version=17.1.20171.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb'	vMapServiceManager	C:\Users\v-tazho\Downloads\CouldNotFindEndpont\vMapServiceManager\Properties\Licenses.licx	2	
    Error		Unable to resolve type 'Infragistics.Controls.Grids.XamGrid, InfragisticsWPF4.Controls.Grids.XamGrid.v17.1, Version=17.1.20171.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb'	vMapServiceManager	C:\Users\v-tazho\Downloads\CouldNotFindEndpont\vMapServiceManager\Properties\Licenses.licx	1	
    Error		The tag 'ucMap' does not exist in XML namespace 'clr-namespace:vMapServiceManager;assembly=vMapServiceManager'. Line 20 Position 10.	WPFMapPrototype	C:\Users\v-tazho\Downloads\CouldNotFindEndpont\WPFMapPrototype\MainWindow.xaml	20	
    

    Could you share us how to resolve them?

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 4, 2017 6:40 AM
  • Sorry, there was a lingering reference to a 3rd party control.  Its cleaned out now and you can download a fresh copy from the link below which should build for you.

    Thank you.

    Sample 2

    Monday, September 4, 2017 6:56 AM
  • Hi moondaddy,

    Thanks for your project, and I could reproduce your issue.

    In my option, it is related with VS designer.

    For a workaround, I suggest you follow below steps.

    1. Change ucMap.xaml.cs like below:

    public partial class ucMap : UserControl
        {
            #region Initialize Variables
            ProxyWrapper.vMapServiceService_ProxyWrapper _v_MapServiceProxy = null;
            #endregion Initialize Variables
            public ucMap()
            {
                InitializeComponent();
            }
            public  void Init()
            {
                _v_MapServiceProxy = new ProxyWrapper.vMapServiceService_ProxyWrapper();
                _v_MapServiceProxy.GetMapSericeMetaDataByProjectCompleted += _proxy_GetMapSericeMetaDataByProjectCompleted;
                _v_MapServiceProxy.Begin_GetMapSericeMetaDataByProject(new Guid());
            }
    
            void _proxy_GetMapSericeMetaDataByProjectCompleted(object sender, GetMapSericeMetaDataByProjectCompletedEventArgs e)
            {
                    byte[] array = e.Result;
                    object[] data = Serialization.SilverlightSerializer.Deserialize(array) as object[];
                    string result = data[0] as string;
                    MessageBox.Show(result, "", MessageBoxButton.OK);
            }       
        }

    2. Change MainWindow.xaml XAML like below:

    <vMsMngr:ucMap x:Name="ucMap" Grid.Column="1" Grid.Row="1"/>

    3.Change MainWindow.xaml.cs like below:

        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
                ucMap.Init();
            } 
        }

    And I could get “The Service Works!” alert after running the project.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by moondaddy Tuesday, September 5, 2017 8:03 PM
    Tuesday, September 5, 2017 7:33 AM
  • Thank you!!!

    That worked very well.  This has been a random issue haunting me for a long time.

    Tuesday, September 5, 2017 8:03 PM