When I tried to add a “Web Reference” to a WCF service (basicHttpBinding), I encountered following behaviors
1. Either it will throw an exception showing “Failed to add Web Reference” and no more clue anywhere, OR
2. Message saying “This page is accessing information that is not under its control. This poses a security risk. Do you want to continue?” it wont wait for your reply, it will go on endless loop until you click “NO” (then you need to close some 50 or windows), OR
3. It will throw an exception message saying, “Could not generate BizTalk files. Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index”
I attached following screen shots for reference:
Tweaking the WCF config file with different setting didn’t give me any luck. At last I figured out the issue is due to the namespace declaration for the WCF service. Just removing the namespace declaration and defaulting it to use “http://tempuri.org/
” (which is not the best practice) solved the problem.
[ServiceContract(Name = “BackOfficeServices”, Namespace = http://companyurl/Service/BackOffice)]
[ServiceContract(Name = “BackOfficeServices”]
I can’t really justify the reason, but I guess it will help someone.