I have created a service reference by Visual Studio 2015. Communication works fine but I have to get application free of app.config file. I tried to create own binding and endpoint but in effect I receive SystemNullReference.
Sample of my code:
var binding = CreateBinding();
var endpoint = new EndpointAddress("http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx");
var Client = new Testowy.Emailver.EmailVerNoTestEmailSoapClient(binding, endpoint );
private static BasicHttpBinding CreateBinding()
{
var binding = new BasicHttpBinding();
binding.Name = "EmailVerNoTestEmailSoap";
binding.CloseTimeout = TimeSpan.FromMinutes(1);
binding.OpenTimeout = TimeSpan.FromMinutes(1);
binding.ReceiveTimeout = TimeSpan.FromMinutes(10);
binding.SendTimeout = TimeSpan.FromMinutes(1);
binding.AllowCookies = false;
binding.BypassProxyOnLocal = false;
binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
binding.MaxBufferSize = 65536;
binding.MaxBufferPoolSize = 524288;
binding.MessageEncoding = WSMessageEncoding.Text;
binding.TextEncoding = System.Text.Encoding.UTF8;
binding.TransferMode = TransferMode.Buffered;
binding.UseDefaultWebProxy = true;
binding.ReaderQuotas.MaxDepth = 32;
binding.ReaderQuotas.MaxStringContentLength = 8192;
binding.ReaderQuotas.MaxArrayLength = 16384;
binding.ReaderQuotas.MaxBytesPerRead = 4096;
binding.ReaderQuotas.MaxNameTableCharCount = 16384;
binding.Security.Mode = BasicHttpSecurityMode.None;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
binding.Security.Transport.Realm = "";
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
binding.Security.Message.AlgorithmSuite = System.ServiceModel.Security.SecurityAlgorithmSuite.Default;
return binding;
}
System.NullReferenceException: Object reference not set to an instance of an object.
Server stack trace: w System.ServiceModel.Security.IssuanceTokenProviderBase
1.DoNegotiation(TimeSpan timeout) w System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout) w System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) w System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) w System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(TimeSpan timeout) w System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout) w System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) w System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) w System.ServiceModel.Channels.SecurityChannelFactory
1.ClientSecurityChannel1.OnOpen(TimeSpan timeout) w System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) w System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout) w System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout) w System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout) w System.ServiceModel.Security.SecuritySessionClientSettings
1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout) w System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) w System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
w System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) w System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout) w System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade) w System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout) w System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) w System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) w System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)Exception rethrown at [0]: w System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) w System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) w WebServices.Testowy.Emailver.EmailVerNoTestEmailSoap.AdvancedVerifyEmail(String email, Int32 timeout, String LicenseKey) w WebServices.Test.GetWebService() w C:\Users\michal.warchulinski\Source\Repos\Aplixcom_CommonComponents\Aplixcom_CommonComponents\WebServices\ClientClasses.cs:wiersz 65 w App.Main() w C:\Users\michal.warchulinski\Documents\Visual Studio 2015\Projects\Soap\Soap\Program.cs:wiersz 22
Excuse me a lot of text. Any clues what can provide this exeption?