I have a web application project being developed in VS2010 targetting Framework 4.0. I need to add a reference to a web service. On the same machine that I am developing on, I created a new project – set the target framework as 3.5 – and selected Web Service Application – and created a Web Service with the default HelloWorld method. I then changed the targed Framework to 4.0 and published this Web Service to a local server – http://mylocalserver/myWebService/Service1.asmx and, if I put that in a browser it all works fine – the Hello World method is displayed and, if you click it, it executes okay and displays “Hello World”.
I then added a Service Reference to my web application project – clicked Advanced and added a Web Service reference. During this process the web service was found and it reported that the Hello World method was available. So, add the web refernce and in the solution I can see under Web References – myWebService – Reference.map – Reference.cs – Service1.disco – Service1.wsdl
Then, if I try to build the web application project the build fails. It says ‘Error 48 Could not load file or assembly ‘file:///C:\Development\EVProject\EVProject\bin\AjaxControlToolkit.dll’ or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
If I remove the reference to the web service – it all builds okay and works fine. If I put the reference to the Hello World web service back in -it won’t build. Take it out it builds and works fine.
Any idea why adding the web reference is preventing it from building? Thanks for any help.
Edit: A bit more info …
A bit more info. On the same development machine I have a Web Site Project. I just added the same web reference to that project and called the web service from it. It builds fine – and calls the web service correctly.
So, two applications on the same development machine.
Both VS2010 – both targetting Framework 4.0
One is a Web Site Project
The other is a Web Application Project
If I add the same web reference to both projects, the Web Application will not build – the Web Site project builds fine and calls the web service correctly. So, who won’t the Web Application Project build?
I had the same problem: my project didn’t build after adding a web reference. I was able to build it disabling ‘Generate serialization assembly’ option from my project properties build tab.