I am getting build failure due to warning in my web.config. Everything was fine before I added .net 2.0 Web service reference to the MVC project. I got warnings of Global element '{element name}' has already been declared for all the elements in my web.config. Searching has only turned up different issues than the one I am having.
Is there any way to fix this issue, perhaps by telling the configuration manager to ignore the config file in the referenced WS assembly?
I can not use the regular service reference as I am not able to call it via https. Or is there a way to reference the 2.0 web service as the regular service reference that can be invoked via https/ssl connection?
Edit: I also have a WCF service reference declared in the project, will that complicate the matter?
I figured out. I don't have to add .net 2.0 WS reference to the project. I can use in web.config to specify the transport protocol to be https.
However, it is wired that adding a web reference would invalidate the web.config elements. I would like to learn the cause of that and would appreciate your input.
I am trying to add a web reference service in an ASP.net MVC project.
However when I add the service I got following error,
Custom tool error: Unable to import WebService/Schema. The object
'Settings' already contains a property
'FreeLance_Web_VATService_checkVatService' not of type
WebServiceUrl. C:\FINALBUILD\User Portal\User.Web\Web
References\VATService\Reference.map
Some How the designer.settings.cs had already a service referenced with the same. Once I changed the name of the service and added again, it started working.
I tried all of the above and I still experienced this issue. It turns out that a reference was stored in my app.config. I got rid of it and then re-added the web refences. That fixed the problem.
What you can do is remove the existing services and try to re-add the reference to the mvc application.Other thing is try to search with the 'FreeLance_Web_VATService_checkVatService' name in the settings.cs and see what it has. There should not be same name for the objects which will lead to this conflict
I had the same issue as I had copied the configuration from another file. I had to delete the configuration and update the web reference. When you add web reference settings is automatically added to the configuration file and hence you should not copy that part from another file. Remove and from your configuration file,update web reference and check if it is recreated.
I am in the middle of trying to write my first windows service using C# and .NET framework and am having trouble referencing a project within the same solution within the service. My MVC solution structure within VS2012:
1 MVC project (web app project)
1 additional processing project (used for extended processing within controllers)
1 service project
1 install shield le project (successfully installs the service project)
Within my service (which I want to fire every x mins) I am referencing methods in the extended processing project that intellisense is able to detect when I am writing code within the service project (I have a using extendedProcessingProject; using webAppProject; and a project references to the extendedProcessingProject and web app project).
The service installs to my local pc without errors. When I start the service I have an error being logged that I cannot seem to figure out:
Exception body: ReminderEmailService Object reference not set to an instance of an object. System.Collections.ListDictionaryInternal
System.NullReferenceException: Object reference not set to an instance of an object.
at ReminderEmailService.ReminderEmailService.ReminderEmails(Object source, ElapsedEventArgs e)
at ReminderEmailService.ReminderEmailService.SendReminderEmails(Object source, ElapsedEventArgs e)
Void SendReminderEmails(System.Object, System.Timers.ElapsedEventArgs)
I know can see though using the System.Diagnostics.Debugger.Launch();
List<SessionReminder> sessions = Queries.GetSessionsToRemind();
//sessions does not have a value, method returns a list of 1
//I suspect this is a project reference issue
debugString += "sessions: \n" + sessions.ToString();
//exception thrown on this line--I suspect because sessions is null
I am using the .NET4.0 (not client profile) on all projects within my solution. Any insight on how to enable my windows service to correctly access these assemblies (webappproject.dll and extendedProcessing.dll) would be much appreciated, as these dll's are being installed by install shield.
It might not be an actual assembly reference issue. The error you are seeing is that the runtime is complaining about accessing methods/fields/properties of a null object. This indicates that your code is accessing an uninitialized object.
The exception you've displayed doesn't look like an issue with referencing assemblies. It looks like a plain ordinary bug in the code, not a missing assembly.
I always create a test harness for a windows service to enable me to run the service as a simple Windows Forms application to make debugging easy.
Separate your service implementation into a separate assembly from the assembly with the actual windows service. Create another project WPF/Winforms with a simple start/stop button. From both the windows service and winforms application reference the assembly containing the functionality that runs within your service.
I am adding a webservice to a web project as a service reference. The error on adding which occurs on adding is
The HTML document does not contain Web service discovery information.
Metadata contains a reference that cannot be resolved.
Before adding the webservice as a service reference I tried adding it as web reference.On doing it there was no error but, i was not able to access a class through the web reference.
So I went for the option of service reference.
I was able to add service reference to a web project and every thing works fine but I am unable to do the same in a class library.
Your help will be appreciated..
Thanks
Right click on your service in Solution Explorer and select View in browser.
you may have some errors in your service and in this way you can find out the errors.
I have a Windows Service Solution and am trying to add a service reference to a Hermes(Opensource ebms message server) Web Service in VS2010.
I can find the Web Service using it's URL, but when I try and populate the Service reference I get the following errors in Visual Studio:
Error 8 Custom tool error: Failed to generate code for the service reference 'testService'. Please check other error and warning messages for details. C:\Users\Admin\documents\visual studio 2010\Projects\MyProject\MyProject.MessageHandler\Service References\testService\Reference.svcmap 1 1 MyProject.MessageHandler
Warning 6 Custom tool warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[#targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:portType[#name='EbmsStatusQuery']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:binding[#name='EbmsSoapHttpStatusQuery'] C:\Users\Admin\documents\visual studio 2010\Projects\MyProject\MyProject.MessageHandler\Service References\testService\Reference.svcmap 1 1 MyProject.MessageHandler
Warning 7 Custom tool warning: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[#targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:binding[#name='EbmsSoapHttpStatusQuery']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:service[#name='EbmsMessageStatusQuery']/wsdl:port[#name='EbmsStatusQuery'] C:\Users\Admin\documents\visual studio 2010\Projects\MyProject\MyProject.MessageHandler\Service References\testService\Reference.svcmap 1 1 MyProject.MessageHandler
Warning 5 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: Schema with target namespace 'http://service.ebms.edi.cecid.hku.hk/' could not be found.
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:portType[#name='EbmsStatusQuery'] C:\Users\Admin\documents\visual studio 2010\Projects\MyProject\MyProject.MessageHandler\Service References\testService\Reference.svcmap 1 1 MyProject.MessageHandler
Some investigation seemed to suggest it is due to svcutil.exe not been able to build the proxys due to not having permissions to a directory (possibly c:\windows\temp). I have tried assigning various access permissions, but I am not really sure which user needs the permission, or if it is just a red herring.
Any ideas would be greatly appreciated.
Thanks
Have to uncheck the Reuse types in all referenced assemblies from Configure service reference option
Check this for details
Right click on your service reference and choose Configure Service Reference...
Then uncheck Reuse types in referenced assemblies
Click OK, clean and rebuild your solution.
I also encountered a similar error when trying to generate the client for a web service from an ASP .Net MVC 4.0 project using Visual Studio 2012.
The root of the problem seems to be that fact that the project from where I was trying to generate the client was referencing an assembly which in turn was dependent on another assembly that was not being referenced as well.
When "Reuse types in referenced assemblies" is enabled in the service configuration, the service generator is probably inspecting all the referenced assemblies to get a list of types that can be reused. The fact that one of the referenced assemblies is referencing another assembly which is not available is probably causing the generator to fail.
Unchecking "Reuse types in referenced assemblies" from the service configurations will solve the above problem, but there is a side effect to it. The reuse types option is there for a reason and in some cases it avoids unnecessary casting in the code consuming the service.
For example, if the service itself is built using WCF and some methods parameters inside it are of type System.Guid, they will be translated to strings in the generated client if the reuse types option is disabled.
An alternative that I prefer to disabling reusing types is to add the service reference from Class Library project specifically created for that purpose. The one thing to keep in mind is to copy all the service related configurations from the class library's app.config to the configuration file of the startup project.
If there are types defined in local assemblies that need to be reused in the service client, those assemblies simply need to be referenced from the above mentioned class library project, along with all their dependencies.
http://uliasz.com/2011/06/wcf-custom-tool-error-failed-to-generate-code-for-the-service-reference/#comment-1647
Thanks to the article above.
In my case, i have this issue with my WPF project in VS.Net 2008. After going through this article, i was realizing that the assembly used in the web service is different version of assembly used on client.
It works just fine after updating the assembly on the client.
It would be extremely difficult to guess the problem since it is due to a an error in the WSDL and without examining the WSDL, I cannot comment much more. So if you can share your WSDL, please do so.
All I can say is that there seems to be a missing schema in the WSDL (with the target namespace 'http://service.ebms.edi.cecid.hku.hk/'). I know about issues and different handling of the schema when include instructions are ignored.
Generally I have found Microsoft's implementation of web services pretty good so I think the web service is sending back dodgy WSDL.
Restarting Visual Studio did the trick for me. I am using VS 2015.
I get the same error in Silverlight 5 (VS2012)
You can also remove the references to:
System.ServiceModel.DomainServices.Client
System.ServiceModel.DomainServices.Client.Web
After you've updated the service references, be sure to add them back in.
As stated above, there are a couple of different problems possible. What we found is that the .DLL for the WCF library had been added as a reference to the client project. This, in turn, created problems with resolving the objects and thus caused the files to be "emptied" by code generation steps. While unchecking the use "Reuse Types..." can seem like an answer, it creates extra definitions of object types, which are proxies to the real types, in a new name space, which then causes all kinds of "compatibility" issues with the use of those types. Only if you really want to "hide" a type should you check this option.
Hiding the type would be appropriate when you don't want a "DLL" type dependency to "leak" into a project that you are trying to keep segregated from another. If the DLL for the WCF library project creeps into the client project references, then you will have this problem with all kinds of strange side effects since the type definitions are also in the DLL.
face same issue, resolved by running Visual Studio in Admin mode
I have encountered this problem when upgrading a VS2010 WCF+Silverlight solution in VS2015 Professional. Besides automatically upgrading from Silverlight 4 to Silverlight 5, the service reference reuse checkbox value was changed and generation failed.
"Reuse types" is not always the problem when this error occurs.
When adding a reference to an older service, click 'advanced' and there 'Add Web Reference'. Now link to your wsdl and everything should be working.
If you want to correct this without uncheking the assembly reuse checkbox this is what worked for me:
Remove referenced assembly that you want to re-use
Delete all the bin folder of the project
Update service reference
Keep "Reuse types in specified referenced assemblies"
Add reference to assembly again to fix the errors
Update service reference again
I had this problem when trying to update my service reference (The error only shows up when adding a service reference though) but didn't want to remove the assembly reuse checkbox.
What worked for me was the following:
Remove referenced assembly that I wanted to re-use
Update service reference
Keep "Reuse types in specified referenced assemblies"
Ignore the errors, it's because the reference is missing!
Add reference to assembly again to fix the errors
Update service reference again
Voila, now it actually updates and doesn't try to remove all of my generated code anymore.
I was almost ready to give up on the re-use types feature...
EDIT: Also make sure that the build config is AnyCPU or x86, since svcutil is buggy with x64.
To the downvoter: Sorry if it didn't work for you, I don't even know why it worked for me, but it did. I may have done something else that time that fixed the problem, but no way to know now.