Can't Add Service Reference to New Console App
Asked Answered
F

5

11

I am trying to add a Service Reference to my brand new console app and I am getting the following error:

Unable to check out the current file. The file may be read-only or locked, or you may need to check out the file manually.

Ref. http://msdn.microsoft.com/en-us/library/t3ec2ktk.aspx

I am not even connected to source control; this is a new project and I didn't check the "Include in source control" checkbox.

I have also tried making the entire project NOT read-only by right-clicking it and unchecking the Read Only box under Properties. However, the project's folder is still read-only... It won't change for some reason.

How can I add my service reference to my project?

Fireboard answered 26/7, 2013 at 15:18 Comment(1)
This issue is solved by this answer: https://mcmap.net/q/1014220/-problems-adding-a-service-reference-to-a-wp8-appPacesetter
F
10

The problem is; I was trying to add a Service Reference, but I should have actually tried adding a Web Reference. As per this page:

Its because you picked service reference, which generates a WCF based stub, which uses different classes and a different programming model. You need to make sure you're creating a web reference, not a service reference (unless you want to use the WCF based stuff), In VS.NET 2008, the web reference option IIRC, is hidden under the advanced button on the add service reference dialog.

Ref. http://boards.developerforce.com/t5/forums/forumtopicprintpage/board-id/general_development/message-id/33779/print-single-message/false/page/1

Fireboard answered 26/7, 2013 at 15:35 Comment(2)
I think you may not be totally correct, as I faced this issue on my PC and when I turned to another pc trying to create the same new project adding new service reference worked smoothly so it is not what the article trying to say. please comment !Petro
@AhmedNazmy Not much to say, all I know is, this solution worked for me at the time. Also, this is VS 2008; so it depends on which version you are using.Fireboard
G
6

Try to Run Visual Studio As Administrator. It seems like a problem in access to some directory.

Generosity answered 28/7, 2014 at 17:38 Comment(0)
E
6

The problem is a bug in Git source code provider. See here:

https://connect.microsoft.com/VisualStudio/feedback/details/789876/unable-to-add-web-service-when-using-git-source-code-provider

To workaround, turn it off when adding a service reference. Or check other workarounds in the above article. Still not fixed in VS 2013 Update4

Elizabethelizabethan answered 7/4, 2015 at 21:50 Comment(0)
Q
3

I know this has been answered, but before trying everything else in the answers, restart visual studio. This just happened to me and 4 other people in my team. Seems to be a problem with visual studio 2013 and not 2012.

Queri answered 16/8, 2016 at 11:0 Comment(0)
D
1

To me the solution was:
1)Removing the Service Reference then adding it again
2)In your web.config, you should check if adding the new reference adds another endpoint, if it does, you should remove one.

Differentia answered 29/9, 2017 at 14:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.