Click here to Skip to main content
15,886,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We are getting the following error when only calling webservice:

"Server Error in '/app' Application.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
   System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) +64
   System.ThrowHelper.ThrowArgumentOutOfRangeException() +15
   System.Collections.Generic.List`1.get_Item(Int32 index) +7504692
   System.ServiceModel.Web.WebServiceHost.AddAutomaticWebHttpBindingEndpoints(ServiceHost host, IDictionary`2 implementedContracts, String multipleContractsErrorMessage) +82
   System.ServiceModel.Web.WebServiceHost.OnOpening() +203
   System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +229
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +121
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +479

[ServiceActivationException: The service '/app/JSON/UserService.svc' cannot be activated due to an exception during compilation.  The exception message is: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index.]
   System.ServiceModel.AsyncResult.End(IAsyncResult result) +11654478
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +194
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +176
   System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +275
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75"

Below is the URL of the webservice: UserService[^]

We have same service on another domain on the same server but it works fine.

Are we missing any reference or settings in IIS?
Any help on above is welcomed.
Posted
Updated 8-Jan-19 0:12am
v2
Comments
Richard MacCutchan 15-Dec-14 7:12am    
The message part in bold is telling you what the problem is. You need to identify what index it is referring to and why it has an invalid value.
Member 11303379 15-Dec-14 7:44am    
Actually we aren't calling any function of the service, only url to it. So, we couldn't identify where it is going to check any index.

And surprisingly same service works on other domain on same server.
You can check below url for same service:
http://eplannerpro.com/app/JSON/UserService.svc

1 solution

i have this problem too.
My wcf service is started by console App (selfHosted) in my client.
so my service is running correctly in the its client , but in another client has this error "Index was out of range ....." although i can brows my service Url On IE and see its Metadata and add service reference correctly to the solution.

another question is :
i published my wcf service on iis. it browse correctly .does it mean My service is started?

please help ..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900