We have a WinForms application (.NET 4.0/C#) that accesses several web services. We deployed to a client who has some proxy feature on their firewall (no proxy settings in Internet Options on the client machine, but it definitely IS a proxy).
The problem is, our WinForms app will fail on the first web service call. The error information isn't very useful but it's clear that it's unable to call the web service methods. The weird part is, once we put the web service (asmx) URL in Internet Explorer on that client machine, it works just fine for several days. It's as if IE is causing the router to cache some of the routing information.
Has anyone else experienced this? Is there a simple fix that we could implement?
Thank you!
Here is the Exception information:
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Net.WebException
Stack:
Server stack trace:
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at AutoUpdater.Module.WebService.AutoUpdaterWebService.AutoUpdater.ValidateInstallKey(String installKey, String computerIdentifier)
at AutoUpdater.Module.WebService.Config.ValidateInstallKey()
at AutoUpdater.Module.RemoteService.ValidateInstallKey()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(System.Runtime.Remoting.Proxies.MessageData ByRef, Int32)
at AutoUpdater.Foundation.Interfaces.IRemoteService.ValidateInstallKey()
at AutoUpdater.UpdateForm..ctor()
at AutoUpdater.Program.Main()
Related
I am migrating WCF services to a new 2019 server running IIS10.
The server that these services come from is a IIS8.5 running on Server 2012R2.
It is obvious that a IIS backup/restore might/will fail as a number of discussions will suggest.
I have set up my remote deployment from VS2019 the same as for the old server.
I can deploy webs and REST services without any problems - BUT WCF services fail:
Fiddler reports 404 Not Found.
Calling the service via test programs under debug brings up the following:
25-02 11:09:43 [24016] FATAL bSm.Kll.Program - System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (405) Method Not Allowed. ---> System.Net.WebException: The remote server returned an error: (405) Method Not Allowed.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- End of inner exception stack trace ---
Server stack trace:
at <System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory1 factory, WebException responseException, ChannelBinding channelBinding)<br> at System.ServiceModel.Channels.HttpChannelFactory1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
I am reasonable sure that I am missing credentials for the service, the problem is WHERE / WHAT is the additional requirement enforced by this server.
As an aside:
I already ran across the problem that the Web Deployment tool has a extra requirement for a "User delegate" which was quite a hurdle on its own. The 3.6 version of the tool had to be collected from the MS website before this requirement was revealed.
My setup is an MVC website that the user connects to, with a REST Web API service that the website connects to behind the scenes. Both the website and web service need authentication and will use the users Windows authentication first to authenticate, and then to pass this identity to an ADLDS directory claims provider I have to see what they are authorized to perform.
Currently connecting to the MVC website hosted on IIS works fine, the windows credentials are authenticated against and then authorized for permissions and the website behaves fine. But when the website makes the calls to the REST service, the REST service checks for the identity and gets the identity of the app pool, not the credentials of the user calling the MVC website. Ie double hopping problem.
This is with impersonate=false in the web.config of the MVC website. I have tried running the MVC website locally on my box through Visual Studio, connecting to the remotely hosted REST service and set impersonate=true in the local MVC web.config and this works. Ie the REST web service then gets the correct credentials through, not the app pool identity.
However if I set impersonate=true in the web.config of the MVC website hosted on IIS on the remote server, the website fails to load at all. So what works in visual studio, doesn't work when deployed through IIS. The exception I get is
01-12-2015 09:52:47,105 [][1] INFO Centrica.CE.SE.PortalX.MvcApplication - **********************APPLICATION STARTED*****************************
01-12-2015 09:53:10,160 [UK\kerslaj1][5] ERROR Centrica.CE.SE.PortalX.MvcApplication - System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the dependency failed, type = "Centrica.CE.SE.PortalX.Security.IClaimsProvider", name = "(none)".
Exception occurred while: Calling constructor Centrica.CE.SE.PortalX.Security.ADLDSClaimsProvider().
Exception is: TypeInitializationException - The type initializer for 'Centrica.CE.SE.PortalX.Security.ADLDSClaimsProvider' threw an exception.
-----------------------------------------------
At the time of the exception, the container was:
Resolving Centrica.CE.SE.PortalX.Security.ADLDSClaimsProvider,(none) (mapped from Centrica.CE.SE.PortalX.Security.IClaimsProvider, (none))
Calling constructor Centrica.CE.SE.PortalX.Security.ADLDSClaimsProvider()
---> System.TypeInitializationException: The type initializer for 'Centrica.CE.SE.PortalX.Security.ADLDSClaimsProvider' threw an exception. ---> System.DirectoryServices.AccountManagement.PrincipalOperationException: An operations error occurred.
---> System.DirectoryServices.DirectoryServicesCOMException: An operations error occurred.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.DirectoryEntry.get_Options()
at System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInit()
--- End of inner exception stack trace ---
at System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInit()
at System.DirectoryServices.AccountManagement.PrincipalContext.DoApplicationDirectoryInit()
at System.DirectoryServices.AccountManagement.PrincipalContext.Initialize()
at System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx()
at System.DirectoryServices.AccountManagement.PrincipalSearcher.SetDefaultPageSizeForContext()
at Centrica.CE.SE.PortalX.Security.ADLDSClaimsProvider.SetApplicationClaims()
at Centrica.CE.SE.PortalX.Security.ADLDSClaimsProvider.Initialise()
--- End of inner exception stack trace ---
at Centrica.CE.SE.PortalX.Security.ADLDSClaimsProvider..ctor()
at lambda_method(Closure , IBuilderContext )
at Microsoft.Practices.ObjectBuilder2.DynamicBuildPlanGenerationContext.<>c__DisplayClass1.<GetBuildMethod>b__0(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)
--- End of inner exception stack trace ---
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable`1 resolverOverrides)
at Microsoft.Practices.Unity.UnityContainerExtensions.Resolve[T](IUnityContainer container, ResolverOverride[] overrides)
at Centrica.CE.SE.PortalX.Security.AuthenticationManager.Authenticate(String resourceName, ClaimsPrincipal incomingPrincipal)
at Centrica.CE.SE.PortalX.MvcApplication.Application_PostAuthenticateRequest()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Any suggestions as to why this works on my local machine but not when hosted on IIS?
I have a windows application (actually an Outlook addin) that calls an asmx web service (yes, it's legacy, but the company is reluctant to move away from it & re-develop everything...) to get some data. The return value is a DataTable. I am calling the web service by adding is as a web service reference.
This has been working correctly for all clients, but recently one client reported an issue where calling the web service throws the following errors (on two separate calls):
Exception Type: InvalidOperationException
Exception Message: There is an error in XML document (23, 93530).
Inner Ex Type: IOException
Inner Ex Message: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
StackTrace: at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at
Exception Type: InvalidOperationException
Exception Message: There is an error in XML document (4426, 32).
Inner Ex Type: IOException
Inner Ex Message: The operation has timed out.
StackTrace: at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at
I am able to rule out that my application is generating the timeout as I am setting the web service class' TimeOut property to 2hrs before the call, and the next request has come through to the server in about 20-30 minutes.
Going through the IIS log, all the requests that have failed for the client have a http status of 200, but also a win32-status of 995.
I have been trying to replicate this error and get the reason why it is occurring without any success for the better part of the last 3 days (I need to find the exact reason - company policy :( :P). I need to know why this occurs and what is the solution or best work-around for this issue.
I have also posted this on the MSDN forum here
Can anyone help me with this? Any help is greatly appreciated. Thanks!
Cheers!
you need to check to see if your hitting a connection limit ask the servers closing it
as the other party to check web.config
<system.net>
<connectionManagement>
<add address="*" maxconnection="40"/>
</connectionManagement>
</system.net>
Sorry if the Title is a little vague but the truth is I do not understand my problem, I have never come across this before and I havent done anything out of the Ordinary.
Right I have a basic Silverlight 4 Application using the Business Application Template. I have also created a WCF Service Application Project which is used to simply return an Observable collection for some entries in my Database,
I published this to my Local computer which I then referenced in my SL4 app and I get this exception
[System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5. <EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest. CompleteGetResponse(IAsyncResult result)
--- End of inner exception stack trace ---
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at RMServiceRIA.rService.Service1Client.Service1ClientChannel.EndgetBuildings(IAsyncResult result)
at RMServiceRIA.rService.Service1Client.RMServiceRIA.rService.IService1.EndgetBuildings(IAsync Result result)
at RMServiceRIA.rService.Service1Client.OnEndgetBuildings(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)}
I have got a clientaccess policy and crossdomain policy which for the purpose of testing is set to allow anything access,
Client Access Policy
Cross Domain
any ideas on how to fix this problem, I debugged my WCF Service and it receives the call, the method executed reaches its return statement, yet my SL4 never even receives the result, as soon as my WCF service has the result I get an exception thrown within my SL4 app, to me it just seems that the connection gets closed but I dont know and I have tried to research but where do you start with something you dont fully understand? I found many people with the same sort of error message but WCF is so damn cryptic... I did try and enable the debugging information inside of my webconfig. I have also tried to host the WCF service on my Web server but no luck, I have several WCF Services running on that with a similar set up so I am unsure why this isnt working
Web Config for WCF Service
client config
Thanks for having a look, and if you need any more info just ask I'll be happy to provide you with it,
Your best bet is to turn on WCF Tracing so you can see what is going on.
http://software.intel.com/en-us/blogs/2010/02/03/adventures-with-silverlight-and-wcf-the-remote-server-returned-an-error-notfound/
Most likely there is an issue with serializing something. Not found is just the Silverlight version of a 500 error.
I'm trying to consume a WF Service hosted in IIS express (xamlx) from a Silverlight Client.
I added my service reference and when I use the client proxy, I get this:
System.ServiceModel.CommunicationException was unhandled by user code
Message=An error occurred while trying to make a request to URI 'http://localhost:52878/Workflows/PerformanceAppraisal/Exempt.xamlx'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.
StackTrace:
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at CompanyHR.ExemptPAService.ExemptPAClient.ExemptPAClientChannel.EndInitiatePerformanceAppraisal(IAsyncResult result)
at CompanyHR.ExemptPAService.ExemptPAClient.CompanyHR.ExemptPAService.IExemptPA.EndInitiatePerformanceAppraisal(IAsyncResult result)
at CompanyHR.ExemptPAService.ExemptPAClient.OnEndInitiatePerformanceAppraisal(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
InnerException: System.Security.SecurityException
Message=""
StackTrace:
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
InnerException: System.Security.SecurityException
Message=Security error.
StackTrace:
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)
InnerException:
When I added the service reference I didn't use http://localhost:52878/Workflows/PerformanceAppraisal/Exempt.xamlx
I used the https version of that. But it seems to be using this url instead.
I am using IIS Express in visual studio 2010.
The error message is quite clear about not being able to find a clientaccesspolicy.xml. This is the result of calling a service on a different site then the Silverlight app is running. You didn't mention the URL to the Silverlight app but it could either be the case of that using HTTPS or being a different site altogether.