I am not exactly sure how to phrase this question but the error I am getting is in the data access layer of an app that is trying to access the api of a web service. The error that I am receiving is an InvalidOperatioException
was handled by user code.
This error happens when I attempt to load a page that should load a grid view of user characters. The code in the DAL where the error is is below.
Public Function SelectAllCharactersByUserId(userId As Integer) As List(Of CharacterDto) Implements ICharacterDao.SelectCharactersByUserId
Dim characterDtos As New List(Of CharacterDto)
Using wcf As New PyritegoldWCF.ServiceClient()
For Each wfcCharacter In wcf.SelectCharactersByUserId(userId)
characterDtos.Add(FromWcfCharacter(wfcCharacter))
Next
End Using
Return characterDtos
End Function
Could not find default endpoint element that references contract 'PyritegoldWCF.IService' 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.
The exception is implying that your app.config is missing some configuration, you should have a section in your app config which looks like the example shown here.