Updating a WCF .map file service reference - c#

Working on a system and need to update a WCF service. The issue I am having is that the service file is a .map file. Using Visual Studio I would have assumed that I could just right click it from solution explorer and update the service from there, but there is no such option.
The .map file itself is an xml containing the Service endpoints and what not. It is also grouped with (could be a plugin "VScommands" that did this grouping) a .cs file of the same name containing the auto-generated code to use the service.
I'm unsure what other information I should provide but if someone could point me in the right direction it would be much appreciated.

So to get around this issue I had to manually enter in the inforamtion I needed. Did this by using the svcutil.exe tool provided by microsoft.

Real late update, decided to just remove the entire service reference and re-add it.

Related

error while renaming WCF service

I created a WCF service (the regular templete one) and tried to access the service. after that everything was fine. after i renamed (using refactoring the name of IService and Service) OSDataService and IOSDataService i got the following error while accessing the srv file :
how can i rename it without getting this error?
i tried also changing it in the web.config file and still the same problem.
Anybody had this problem?
You have to view the markup of the service file and change this in the directive to be the new name because it doesn't change automatically
Right click on the service name, then chose "view markup" and then change the "Class" attribute to be the new name.
Do you have a .svc-file? Have you updated the markup in that file if you have one?
Do a search in the whole solution after the old service name and you will moste likely find the file that need to be updated.
Well solved it:
you need first to rename the Iservice on the solution explorer, then refactor the service and refactor again all the data (VS2010 will tell you what to do) only then rename the service name (on the solution explorer)
You must update the reference in the client. Or update the stubs manually, but I wouldn't recommend that.

Windows Services - Is it advisable to update its config file while running?

As per my title, I would like to clarify: Is it advisable to update the config file while a .Net windows service is running?
What would be its implications, if this is possible?
Thank you.
Cheers,
Ann
There are other excellent answers here, but what are you asking? Are you asking about a service that you are writing? Or about someone else's Service.
If it is about a service you are going to write, then no, there is no automatic reload of the .config file when it is changed. You will either have to:
Restart the service to see the changes.
Write your service to use a FileSystemWatcher to see if the config file has been changed and then decide what you want to do with any or all the values that have changed.
If it is about someone else's service, you will need to ask them how it works based upon the above description.
This should have no effect on the running program. Configuration is loaded during application startup. If you want those new settings to take effect, you need to restart the service.
Edit:
More to the point of answering your question: When one creates a Windows service in .NET (I'm using Visual Studio 2010), an application configuration file is not created with it by default. By adding a New Item / Application Configuration File (App.config), you are creating a file that gets loaded at the start of the service. As commented below, there is no guarantee that it isn't being monitored during run time (unless you're the creator and you know that's the case), but this is not the common practice for App.config.
Under these standard conditions, it is advisable to make the changes, while running, after backing up the working copy of the config file. Then restart the service. If you broke it, revert back to your working copy.
You can do it but it comes with a cost,
do you want your service poll to know if there is any changes to the config file while it is running ?
Generally, I would not recommend polling for the content changes in the config file.

SOAP Web Service / VS2010 Add Service Reference

I am having problems gaining access to a clients web service online.
If I have the wsdl file, can I do "something" in VS2010 with it so I can add it as a reference and start my C# coding?
Thanks Paul
When you go to "Add Service Reference", the textbox that allows you to enter a URL, can also take a path on your local filesystem to a wsdl.
Additionally, while not the optimal route, you can also use the wsdl.exe/svcutil.exe utility (bundled with VS) to generate a proxy class. Adding a reference is the better way to go, but this is an additional option.
Adding the Service Reference as a local path worked for me like a charm. I would have voted +1 for xelco52, but my rep is too low...
Only 1 issue; one of my members of the class I've added does not work. I wonder if I need to use the sledgehammer...?
If you have the WSDL file, under one of your projects in VS, right-click the References project folder and choose Add Service Reference. Click the Advanced button, and in the new dialog click Add Web Reference. Now, go find the WSDL file, either where you saved it or where you downloaded it, enter its location in the textbox, and click Go. VS will digest the WSDL and produce a class that is the service client, and others as necessary to implement custom types accepted by the service.
It's usually a good idea, if you have downloaded the WSDL, to include it as an item in the project that has the web reference; that allows it to be easily traversed as a reference source, and to be located should you need to recreate the web service classes.

Deployment schema problem

I have changed my app name and namespaces as well from FooXXX to FooYYY.
VS applied changes to all files. I've checked all namespaces, names etc, project compiles but when I want to deploy it to emulator or to a device it crashes straight away. No warring, no message, no exception. Only spash screen is shown and then OS gets back to start screen.
I made a copy of this solution and I've changed all names, namspaces again and now app compiles and deploys, but I have two messages:
Message 2 Could not find schema information for the element 'http://schemas.microsoft.com/client/2007/deployment:Deployment.Parts'.
Message 1 Could not find schema information for the element 'http://schemas.microsoft.com/client/2007/deployment:Deployment'.
Any clue what casuses the crash?
Check the "Startup Object" in the project properties page. The sometimes requires manually being set/corrected when the namespace of the app is changed.
I had the same problem but it was due to the WCF RIA Services link.
In the project properties change the WCF RIA Services link to
Save and close the tab
Change to the previous link
Save
I got a problem like this and it was a problem inside WMAppManifest.xml file under Properties. Look at the TokenId, default page etc...
To resolve this, I actually just restarted VS2012.

Generating the App.Config file for a Managed Windows Service using WCF

My next project is going to be using Windows Communication Foundation to host Managed Windows Services, so I have been trying to follow a HOWTO on msdn - How to: Host a WCF Service in a Managed Windows Service. Sounds like a perfect match.
All was well until it started mentioning an App.Config file but without outlining how it got generated in the first place.
As I have posted there, there is probably some assumed prior knowledge (perhaps from another tutorial), but I couldn't find the answer after some searching.
Thanks in advance.
Are you talking about item #5? The app.config file is generated by you. You can add the item to your project in VS.NET by right clicking on the project and selecting to add a new config file. Then you can add the section as indicated by the step.

Categories

Resources