Msbuild gives error while invoking custom task - c#

I have created custom task in C# library project. Within this project I have added service reference. Using this service reference object i have written code in excute method, to invoke service function.
After building this library project, dll and dll.config files are generated.
dll.config has service endpoint descriptions which is same as app.config.
Now i am trying to invoke this task(which internally calling service function) through msbuild. But it giving error - " Service end points could not located......"
Can someone help to provide correct approach to solve above problem?

Related

Using MEF in an Azure function App

I am trying to use MEF in my function app. My requirement is to access 5-10 external APIs, fetch,aggregate and return the data through an HTTP triggered function. I need to resolve the external dependencies dynamically based on some logic. These external components are already built and exported. I need to import them along with metadata.
I observed that System.ComponentModel.Compositionassembly is already referenced in a default function app created in VS 2017. Not sure how to proceed. A sample setup code would be helpful if at all it is possible in Azure functions.
Based on your scenario, I created my Http Trigger function via VS2017 to test this issue. I followed the Simple Calculator MEF Application. And here is the structure of my project and as follows:
Without adding the extension lib which supports the Mod operation into the Extensions folder, you could retrieve the following result:
While added the ExtendedOperations.dll, the Mod operation could work as expected as follows:
On my local side, I added the path for initializing DirectoryCatalog via hard code. When deploying to azure side, your precompiled function lib would be deployed under D:\home\site\wwwroot\bin>, you could add your Extensions folder within it and use the following code for retrieving your extension folder:
Path.Combine(System.Environment.GetEnvironmentVariable("HOME"), #"site\wwwroot\bin\<your-extensions-folder>")
Also, you could leverage kudu and navigate to D:\home\site\wwwroot\<your-function-name>, then add your Extensions folder under it, then init your DirectoryCatalog with the path Path.Combine(System.Environment.GetEnvironmentVariable("HOME"), #"site\wwwroot\<your-function-name>\<your-extensions-folder>").

Visual Studio does not generate client proxy code when adding service reference

I have a WF [Workflow Foundation] project and when I try adding a service reference [Visual Studio 2013-Target Framework is 4.5.1] to it the generated reference code doesn't contain the client proxy code. I tried adding a service reference to other non WF projects [Library projects] and it works fine and the reference.cs contains the Client proxy code. Why Visual Studio doesn't generate client proxy for WF projects? If the facility is not there then obviously I am taking the wrong approach. How can I use a WCF method inside my CodeActivity?
Just to remind you that this is not the duplicate of the following thread :
Service reference not generating client types
Instead of a simple Reference.cs file Visual Studio kindly adds 7 more files to the service reference folder. When I recompile the project and build it all the methods of my WCF service appeared on the toolbox [and became available] and now I can use them in my Work Flows.

Service Reference (VS2013) more than one fault is declared with element name in namespace

I'm attempting to consume a web service created by Oracle Web Logic in Visual Studio 2013. I've added the service reference OK but when I call the service constructor I get the error:
In operation (operationName), more than one fault is declared with element name (elementName) in namespace (namespace URL)
The snippets for this operation from the WSDL is shown in the image below:
This exception is thrown each time I attempt to use the service, and I can't proceed any further.
Is this an issue with the WSDL or is there something I can do as a consumer?
I am not sure what is the exact cause of the problem you are facing.
Can you try to generate the proxy using svcutil and give it the flag to generate using the xml serializer.
svcutil.exe /target:code /dataContractOnly /serializer:XmlSerializer
/importXmlTypes [your xsd file's path]
Here is a thread that talks about a similar problem with proxy generation: http://social.msdn.microsoft.com/Forums/vstudio/en-US/66f8c5c0-0c3e-47de-abd3-ba6e1a228f2d/wcf-proxy-data-class-duplication-bug-generating-client-proxy-for-nonwcf-service?forum=wcf
I have some WSDLs that cause me grief in VS newer then 2008. I get around it by using VS2008 and adding the service references there. Then I can save and migrate the generated code over to my VS2010-13 projects. Unfortunately I have not yet found another solution.

Cannot instantiate objectVO class from another project from WCF Service Library project even though they are in the same solution

I've been trying to create a webService on a .NET platform using Visual Studio's WCF Service Library project template. I noticed that when I tried to use a VO object from another project file within the same solution... programatically, the compiler has no issues and runs fine... but when I call the webService, it will stop the application prematurely.
I've done some google-ing and the closest answer I could find was the possibility that since WCF is run from a separate location, the VO.dll file that I added in as a reference is not available to it.
As a reference to the above statement... please find the enclosed link:
http://forums.asp.net/t/712261.aspx
Thanks

Can't use service reference in ASP.NET project

I successfully added a WCF Service Reference to my ASP.NET project, but I'm not able to use it.
I can't import the service referenece via using MyProject.MyService.
This worked in a standard Windows Form project and I now, that the requested service is working.
Thanks for your help.
Edit:
There occure Warnings during the generation of the service client
I think the "main" warning is the following
Warning 1 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension:System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Type 'Newtonsoft.Json.Linq.JToken' is a recursive collection data contract which is not supported. Consider modifying the definition of collection 'Newtonsoft.Json.Linq.JToken' to remove references to itself.
This warning comes only at the generation in an ASP.NET project. The generation works in my other projects.
It seems that this is a problem of a class I'm not responsible for. May I have to change the settings for the service reference creation or avoid some imports in the original WCF Service class?
We need some more information in order to troubleshoot this for you. Is the reference being added but you cannot use it?
I would suggest looking at the reference.cs file (under the service reference, you may need to tell solution explorer to show all files - little icon of the folders and files at the top) and seeing what namespace it has been generated with.
I think you're probably just not using the correct namespace to reference the client.
The other possibility: check for any compiler warnings, they might give you a clue as to what is going on.
EDIT: This seems to be an issue encountered by others. Do you have the json.net package installed?
Please see the following for details:
Getting "Recursive collection data contract" when referencing a WCF service with a slightly complex method

Categories