"Add Service Reference" reference.svcmap and ServiceReference.ClientConfig empty - wcf

I have an ASMX service that I wan't to add to my Silverlight project (in the near future this will be converted to a WCF service).
When using the "Add (or Update) Service Reference" not all the files seem to be created and files under Reference.svcmap aren't created and the ServiceReferences.ClientConfig is empty.
Has anyone ever come across this before?

Not sure I have a good answer for this one. I see this every so often. Usually the problem can be traced by looking at the output window entires that occured during the attempted proxy generation.
Sometimes it is caused because invalid or unsupported Wsdl or just some silly issue with serialization of one of the types.

Try to give your client (Silverlight) application the WSDL, not just the ASMX when adding the service reference.
e.g. http://myserver.com/services/mywebservice.asmx?wsdl
Remove the service reference altogether from your client project, and try adding it again this time with the WSDL.

Related

WCF fails to import WSDL

I'm trying to "Add Service Reference" with WCF to the following wsdl: https://se-face-webservice.redsara.es/sspp?wsdl
The visual studio does not provide any warning but the reference.cs is empty and no serialization took place.
I have already tried removing the "Reuse types in specified referenced assemblies", however the serialization stills fails.
If I tried to add the service with the WcfTestClient it gives an error stating that : 'http://schemas.xmlsoap.org/soap/encoding/Array' is not defined.
Finally, when I add the wsdl through a "Add Web Reference" the serialization takes place. I'm guessing that maybe the service is using "unknown" bindings to WCF.
Is there a work around for this situation?
PS: If I use the SoapUI to generate the client everything works fine.
Your WSDL is faulty. It defines the prefix soap-enc, but does not define the schema which defines it. The WSDL is assuming that the http://schemas.xmlsoap.org/soap/encoding/ schema is automatically defined.
Perhaps this service is built on an old version of Axis? I have seen that version assume that the consumer is also built on Axis.
I've tried good old wsdl.exe for generating web service references with System.Web.Services and seems to work - generating and compilation at least :-)
Can you check it? Link to project on bitbucket. Just simple console app with references and generated assemblies.
https://bitbucket.org/polacekpavel/servicestack_27747564/src
and interesting one - generated proxy class https://bitbucket.org/polacekpavel/servicestack_27747564/src/c43b90221fae7ceb2e234552b9f57034551b3cbf/SSPPWebServiceProxyService.cs?at=master

Add Service Reference doesn't generate proxy

I understand there are other similar questions, but I haven't been able to find a working response.
I create the default WCF service from the template [which comes with GetData() and GetDataUsingDataContract()].
It runs fine in the browser.
I have a separate web site to which I add this new WCF service:
I do 'Add Service Reference', enter my URL, the service comes up and I click 'OK' to add it.
Under 'App_WebReferences', I see the namespace of my added service: 'ServiceReference1', with 'References.svcmap' under it, and a couple .svcinfo/.wsdl/.xsd files under that.
No proxy files are created, but <system.serviceModel> element is added to my web.config, with what seems to be proper information.
However, with no proxy, I can't access/call any methods in my service (ie ServiceReference1.WCFMethod1())
I can call svcutil, generate the proxy, add it to my App_Code, and everything works as it should.
My question is, why isn't my proxy being created with 'Add Service Reference'?
Everything is under target framework: .NET Framework 4.
EDIT:
Just created a Console App and added the service reference and it created the proxy.
So the issue is my web site is not creating the proxy...
I had this same problem and found that unchecking Reuse types in all referenced assemblies did solve the problem. However, in my case, I needed it to reuse types from some of my referenced libraries. I found this post, covering a very similar problem. In that post, it references a Microsoft knowledge-base article which describes a fix for the the following issue:
Consider the following scenario:
You create an ASP.NET MVC4 Web API project in Visual Studio 2012.
You add a WCF service reference in the project.
In this scenario, the Reference.cs file for the service reference is empty.
Cause
This issue occurs because the DataContractSerializer class has encountered a type (Newtonsoft.Json.Linq.JToken) that it does not support. In this case, it throws an exception, and then stops generating the service reference.
I wasn't referencing that JSON library, but, based on that bug description, I surmised that one of my referenced libraries must have had a similar problem. I figured that one of the libraries that I was referencing probably contained a type that was not supported by the DataContractSerializer, it was throwing the same kind of exception, and it was therefore failing in the same way.
Sure enough, I found out that, in my case, the culprit was one of my own libraries which happened to include a public proxy for the same WCF service. I suspect it was that public proxy that was causing the trouble. In any case, by selecting Reuse types in specified referenced assemblies, and then selecting all of the assemblies except that one, the service reference automatically generated the proxy classes correctly.
When you are adding a ServiceReference : References -> Add new service reference.
Clik on advanced button and uncheck "Reuse types in all referenced assemblies".
This option sometimes causing errors.
Here is the main issue.
The issue source is when you are not able to find Add Web Reference in your visual studio. If the service is asmx, in my case it wasn't generating proxy class until I found these steps -> click on Sercice Reference -> Click on Advanced -> There you will see Add Web Reference... Provide your service URL hit OK issue resolved.
Hope this helps.

WCF: Updating Service Reference gives duplicate config entries

I have a WPF application using service references to a WCF service. When doing updates on the service I need to update the service reference, so I right click it and hit "Update Service Reference".
Doing this results in duplicate entries in the App.config file of the client project.
It duplicates a binding under wsHttpBinding - adding an equal entry with postfix number in name: WSHttpBinding_ISomeService --> WSHttpBinding_ISomeService1.
And it duplicates the endpoint definition under binding such that there is one endpoint for each wsHttpBinding. This too is a pure duplicate except of the name.
Why does it duplicate the config? Isn't it just supposed to update the name? And how can I make it stop?
Which version of Visual Studio are you using? This is a known bug, which has been fixed in VS2010. Check out this link!
code-zoop says that this known bug is resolved in VS2010, but I'm getting it in VS2010 as well.
Happens when I manually modify the default value for the MaxReceivedMessageSize property (and others) of the basicHttpBinding in App.config (as per this post: WCF - How to Increase Message Size Quota)
Just thought I'd mention that this happens in VS2010 as well. For the moment, I'm taking Shiraz Bhaiji's advice and just deleting the duplicate, which seems to be working for the moment being.
This has also happend to us on a few occasions.
You need to remove the duplicate, otherwise it will crash at runtime. The client looks in the configuration file to find where it should send a request to Interface(WCF contract X), finds more than one, and crashes.
one workaround is to put the service agent (web reference) in its own DLL and reference it from the main project.
it won't touch your service agent config in your web.config when you do Update Referene and as a bonus you'll have a project with up to date serviceagent config if you ever need to compare the default configuration with what you actually have in web.config
also has the benefit that if you have one service agent referencing another it will share the types
MAIN DLL > ServiceAgent1 DLL > ServiceAgent2 DLL
If ServiceAgent1 and ServiceAgent2 have shared types you won't get two generated duplicate classes

AddressFilter mismatch at the EndpointDispatcher

I have a WCF Web application that uses a WCF Class Library.
My project is a WCF Web project and I am self-hosting.
My problem is that all my web service methods hang with:
And "Unable to automatically step into the server...etc".
The error (not very helpful) returned is:
The operation has timed out
When I invoke the same method(s) using the WCF Test Client
I get the correct response and everything goes smoothly.
So, something must be wrong with my web application.
Following up on a similar post, I used the Service Trace Viewer.
I am getting the error:
The message with To
'http://localhost:8731/Design_Time_Addresses/Authentication/mex/mex'
cannot be processed at the receiver, due to an AddressFilter mismatch at the
EndpointDispatcher. Check that the sender and receiver's EndpointAddresses
agree.
After reading a related post, I tried adding:
[ServiceBehavior(AddressFilterMode=AddressFilterMode.Any)]
And recompiling my class library and updating my services to no avail... still hangs.
I have tried adding both my web service and my web project as startup projects but
I am still unable to step into the code. I also have all the appropriate DEBUG attributes
set in Web.config and App.config.
Any suggestions out there?
From my experience the mex/mex error occurs when I update a service reference in Visual Studio. I have come to the conclusion that this is just part of how Visual Studio figures out how to update the web service rere
Without knowing what your configuration looks like, it's hard to say what's wrong. However, why does your URL have /mex twice in it? Are you sure that's right?

Update service reference not working

I'm using Visual Studio 2008 and have a WCF client working against a WCF service. They are both located in the same Visual Studio solution. After I've made a change in my WCF contract, I want to update the service reference on the client so that changes made to the contract is also made in the proxy.
My problem is that the proxy code is not re-generated.
When I select to update the service reference, the following happens:
A dialog with the title "Updating service reference 'name-of-reference'" is shown. This dialog has a progress bar.
The progressbar moves and the status text in the dialog is changed to "Updating configuration"
The progressbar moves a bit more, and the status text is chnaged to "Configuration update complete"
The dialog doesn't show the text "Generating \something\" (can't remember the exact wording) which I would expedct.
If I delete the service reference and add it again, the proxy is properly generated. I add the service using the exact same settings as before, so I don't think it's a issue I can solve by changing the service reference configuration on the client.
One thing I suspect may be the problem is that I've renamed the default wsHttpBindings in app.config. I've also renamed the default endpoints. The reason behind this is that I need more than one endpoint and having one named 'some-default-name' and one with my own name is just confusing.
The problem with deleting the service and adding it again is that Visual Studio adds a new binding in app.config (among other things) which should not be there.
Anyone seen this problem before? Anyone knows of a solution to it?
When we have had this problem it has usually been one of these errors:
The size of the contract has increased, and is now so large that the WCF configuration does not allow it to be transferred.
A new class has been added to a WCF Interface and that class is not marked as serializable.
There is a compile error that stops the code from building and it therefore uses the old dll
I've run into this problem with the following conditions:
Our workstations are connected to an Active Directory domain (nearly everything uses Windows Authentication)
The service reference I'm trying to update is hosted on localhost, and is running under IIS Express (so the Application Pool user is running as the developer's personal domain user account)
Another developer has added or updated the reference to the project more recently than me.
The only way I have figured out how to workaround this issue is to edit the configuration.svcinfo file for that service reference (you will need to show all files for the project to see it in visual studio), locate the following section:
userPrincipalName value="user#domain.com"
and change the user to my own domain user. After saving the file, I have no trouble updating the reference until another developer updates the service reference (likely using the same workaround). Unfortunately, I haven't been able to figure out a permanent solution to this issue.
My error was that I forgot to add the OperationContract attribute.
In my case the problem was that the previous developer had added the service reference using his machine name rather than localhost. So when I told Visual Studio to update, it connected to his machine, which did not have the changes. I modified the service reference files and replaced his machine name with localhost and it was able to update the reference.
I had this problem too. Deleted the service reference and recreated it again.
My problem was that I had two methods with the same name. Everything builded fine, but I couldn't update service reference. When I tried to start just the WCF service, the error pops up.
Two easy steps to solve that:
Run Service, then stop it.
Update service reference.
Highlight the service as the active project, F5 to run it in VisualStudio, it will start up in the service test app. Stop debugging. Then try to update your service reference - worked for me.
I know this solution is a bit late, but after trying the posted solutions with no success, this worked:
When you create a WebService, it generates a .dll file that you reference as your service reference. This .dll is (as most know) not recreated everytime you make changes to the .SVC file. You can see this if you go and view the date modified property of the web service .dll file, in my case it was three hours old!
My solution was to make appropriate changes to the service contact, save it, and re-build the project which will cause it to recreate all the .dll's reflecting the changes you made to the service contact file (.svc).
After this, update the service reference on the client app, and the changes are evident.
Spades
I had the same problem. Modified some of the data contracts. Tried to "Update Service Reference" and did not see the change. Dropped and re-added the service. Still didn't see the change when writing code in the client. Opened my client with Reflector and saw the service types had the change! So why was intellisense still showing old properties? Restarted Visual Studio and the modifications finally showed in intellisense.
I had the same problem, this by me it was caused by GIT Merge Conflict, i was missing the following code from my csproj file
<ItemGroup>
<None Include="Service References\<SERVICE NAME>\Reference.svcmap">
<Generator>WCF Proxy Generator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
</ItemGroup>
I have added this onder the line of Reference.svcmap
Another solution to these kinds of problems is if your namespaces get jumbled in referenced projects that both consume the service. So:
ProjectA - Consumes ServiceA
ProjectB - Consumes ServiceA, Has Reference to ProjectA
If you change ServiceA and update ProjectB, sometimes the namespaces can can change to look at ProjectA's version of the service.