I cannot add service reference(WCF library) to MVC4 in VS2012 - wcf

My problem is very simple, but unfortunately I cannot figure out what's wrong. I've created a new MVC4 Internet Application project with Razor syntax, then I added another WCF Library project to this solution. I did not make any change on these codes. However, as I added the WCF project as a service reference in the MVC 4 app, I'm getting 1 Error message and 3 Warning messages:
Error 4 Custom tool error: Failed to generate code for the service
reference 'ServiceReference1'. Please check other error and warning
messages for details. c:\users\vendre\documents\visual studio
2012\Projects\MvcApplication3\MvcApplication3\Service
References\ServiceReference1\Reference.svcmap 1 1 MvcApplication3
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: Could not load file or assembly 'DotNetOpenAuth.AspNet,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246'
or one of its dependencies. The system cannot find the file
specified.
Warning 2 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://tempuri.org/']/wsdl:portType[#name='IService1']
Warning 3 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://tempuri.org/']/wsdl:binding[#name='BasicHttpBinding_IService1']
I read some article but did not resolved my problem. If somebody know the answer for my problem, please tell me.
THX.

When you add the reference, on advanced setting remove the reuse types checkbox.

If you're experiencing this problem in 2021 with VS2019. Add a folder to the project called "Connected Services"

sometimes you need to create a folder "Service References" in project path. If you dont have this folder it should gives this path error.

If using VS 2019, check if in Solution Explorer you see "Service Reference". Than edit the project file for following
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>

In Visual Studio 2019, I fixed the error (system cannot find path specified) by creating a new folder named "Connected Services" inside project folder

In Visual Studio 2022, You need to create a folder "Connected Services" in project path, via Windows Explorer, not Visual studio solution explorer'

You can try the following :
Delete the "Connected Services" folder from the project in Visual Studio
Add the service reference with right-click on the project / Add / Service Reference...
It should work and recreate the "Connected Services" folder with your new service reference.

Related

Failure writing debug information: Unable to load DLL 'Microsoft.DiaSymReader.Native.amd64.dll'

I installed a VS2017, tried to develop a first app in VS2017.
File > New Project > Visual Basic > Windows Desktop > Windows Forms App (.NET Framework)
simply tried to run an app with only one label on form, but build error comes up, I clicked on "Yes" then dialogue box appears (image).
Error Code- BC37225
Error Message- Failure writing debug information: Unable to load DLL <br>'Microsoft.DiaSymReader.Native.amd64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Then searched SO, read and tried solutions, but not worked.
What I tried from SO is-
Error while building C# Console Application: Error CS0041 Cannot find a module
(1) installed Microsoft.NETCore.Platforms (nuget package)
(2) installed Microsoft.DiaSymReader.Native.amd64.dll (nuget package)
(3) Unable to load DLL 'Microsoft.DiaSymReader.Native.amd64.dll
in this, solution is available (accepted answer), but I don't know from where to delete these lines of code.
<PropertyGroup>
<Deterministic> true </Deterministic>
</PropertyGroup>
what could be the solution?
When the build errors dialog comes up it asks if you want to run a previous build because the current build will not compile (won't make a new .exe file) Since this is the first run of your program there was no previous build, no .exe. What you need to resolve are the build errors.

Error on importing Wsdl as a connected service

I have an application that targets .NET Core.
When I try to import a wsdl file, I get the following error.
Scaffolding Code ...
Error:Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Schema with target namespace 'http://xml.amadeus.com/2010/06/Session_v3' could not be found.
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://xml.amadeus.com']/wsdl:portType[#name='AmadeusWebServicesPT']
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://xml.amadeus.com']/wsdl:portType[#name='AmadeusWebServicesPT']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://xml.amadeus.com']/wsdl:binding[#name='AmadeusWebServicesBinding']
Warning: Cannot import wsdl:port
Detail:
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://xml.amadeus.com']/wsdl:service[#name='AmadeusWebServices']/wsdl:port[#name='AmadeusWebServicesPort']
Error: No endpoints compatible with .Net Core apps were found.
An error occurred in the tool.
Failed to generate service reference.
Is there any solution or workaround to that problem ?
Thanks.
Edit:
I have figured out the problem. To re-generate the stub, I need to run "svcutil.exe" directly from the command line (or generate the stub in some dummy C# project) because WCF Connected Services cannot generate a stub from this WSDL.
The generated code of the regarding wsdl uses following attributes that are not supported by .Net Standard 1.6.
SerializableAttribute, DesignerCategoryAttribute
When I create these two attributes manually, then I am able to make my application build.
We can add services in 2 ways from addservices or from dotnet-svcutil tool.
The problem is that your web service endpoint's WSDL uses a different way of storing the XML operation data. As Henk points out, using the wrapped flag when manually running the dotnet-svcutil tool is the solution here.
Follow these steps:
Edit your .csproj file and add the following node inside the <ItemGroup> node: <DotNetCliToolReference Include="dotnet-svcutil" Version="1.0.*" />
Open up a PowerShell terminal from within the folder where the .csproj file resides.
Run dotnet restore
Run dotnet svcutil https://smp.difi.no/ws/2.0?wsdl -wr

Issue with GlobalExceptionHandler Sharepoint 2010

I have a fatal error which I do not know how to solve,even after several days of trying.
The error that i have is :
"Could not load file or assembly 'GlobalExceptionHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ed6585c9914bae60' or one of its dependencies. The system cannot find the file specified."
For more details:
-I had never before seen this error but when I deployed a project I encountered the error cited above...
-So ,after this change, I assume that the action mentioned before caused me this error.
-For this, I executed orders at "Windows PowerShell" as: stsadm-o-name deletesolution solutionName.wsp to remove the solution completely.
-After that, I made sure that the project I deployed ​​is no longer in my server.
-Later, when I logged to the" Sharepoint Central Administration" on port 24427. ,in hoping not to see the error anymore ,i saw that the error has not disappeared .
So , now i no longer have access to the " Sharepoint Central Administration",as the error remains.
I will be grateful to any proposal from you.
Thank you & sorry for my english. .
Please try out below few steps:-
1.Deploy the assembly to GAC or copy the dll to the bin folder of your web application
2.Add the assembly info in your web.config assemblies section and in the safe controls section.
3.Redeploy the solution.
This should help.

Activate Visual Web Part Package in Share Point 2010

I have created a new project of SharePoint 2010 --> Visual Web part,
seleted it as form solution. and it created the web part.
I just edited it with Hello World! for confirmation and deployed it using VS, and successfully added to page.
problem, arrises when i activated the same package after uploaded it from site actions--> site settings --> galleries --> Solutions
-- > upload new solution --> activate it.
error came:
This solution contains invalid markup or elements that cannot be deployed as part of a sandboxed solution. Solution manifest for solution 'GUID' failed validation, file manifest.xml, line 14, character 4: The element 'Solution' in namespace 'http://schemas.microsoft.com/sharepoint/' has invalid child element 'TemplateFiles' in namespace 'http://schemas.microsoft.com/sharepoint/'. List of possible elements expected: 'FeatureManifests, ActivationDependencies' in namespace 'http://schemas.microsoft.com/sharepoint/'
I don't know why VS didn't get this error while its deployment or i am missing some thing while my deployment.
any idea?
Try to make your visual web part as sand boxed solution your problem will be resolved

ajax control toolkit & sharepoint 2010

I was trying to use ajax control toolkit in sharepoint 2010, but i get some errors. I found that the last release of the toolkit doesn't work with SP2010, so i downloaded the version 30930 found at http://ajaxcontroltoolkit.codeplex.com/releases/view/33804
Then i modified the web.config adding this:
<assemblies>
....
<add assembly="AjaxControlToolkit, Version=3.0.30930.28736, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
I added the dll to the references (creating a new tab in the toolbox and browsing the dll file) and started using the ajax controls in my web part. It deploys without problems, but when i run my webpage i get this error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load file or assembly 'AjaxControlToolkit, Version=3.5.40412.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Which points to the first line of my webpart ascx file
Any ideas?
It looks like your web part references version 3.5.40412.0 of the AJAX Control Toolkit in an #Register directive. Since you want to use version 3.0.30930.28736, and since that version is properly referenced in your web.config, you should register the toolkit in your web part using its assembly name and namespace only, e.g.:
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="ajax" %>
Take a look at this blog article which explains how to use the Ajax Control Toolkit with SharePoint 2010 http://www.inspiredbytechnology.com/index.php/2010/10/28/using-the-ajax-control-toolkit-with-sharepoint-2010/