Visual Studio OData "Add Service Reference" code-gen failing - c#

This data.gov website gives an OData data export with instructions to use the link http://data.cms.gov/OData.svc/97k6-zzx3
(After Nugeting Install-Package Microsoft.Data.Services.Client version 5.6.1) I attempt to use the full link to "Add Service Reference" to my C# project in either Visual Studio 2012 or Visual Studio 2013, I get There was an error downloading 'http://data.cms.gov/OData.svc/97k6-zzx3/_vti_bin/ListData.svc/$metadata'.
The request failed with HTTP status 404: Not Found. ...
If I truncate the URL to http://data.cms.gov/OData.svc then I get one step further, but still an error The custom tool 'DataServicesCoreClientGenerator' failed. Data service client code-generation failed: Schema specified is not valid. Errors: ... The 'Name' attribute is invalid - the value '97k6-zzx3' is invalid according to its datatype (I suppose since C# identifiers cannot begin with digits)
Is this a bug with data.cms.gov or Visual Studio (etc)? Is there a close workaround?
Thanks!

Try using https://data.cms.gov/OData.svc/$metadata. Code-generation needs metadata, the above URL will provide that.
The URL https://data.cms.gov/OData.svc is the service document, not metadata.

Related

WCF Web Service / Visual Studio Community 2022 / Compiler Error CS0120

I want to access a web page in a Windows Forms app via SOAP.
Unfortunately, the compiler spits out many errors after I added the WCF Web Service to the project. What am I doing wrong here? The possible options don't tell me anything. The examples I found on the Internet could not help me with the errors.
Visual Studio Community 2022
WCF Web Service
URI: https://www.onlinembe.de/wsdl/OnlineMbeSOAP.wsdl
[ ] Always generate message contracts
[X] Reuse types in referece assemblies
[X] Reuse types in all referenced assemblies
Access level for generated classes:
[X] Public
Compiler Error CS0120
An object reference is required for the non-static field, method or property "ShipmentRequestType.System".
In 'Reference.cs' add 'using System.Xml.Schema;'
and replace
'Form=System.Xml.Schema.XmlSchemaForm.Unqualified'
with
Form='XmlSchemaForm.Unqualified'.

Can't add reference to HttpBaseProtocolFilter

I am coding a tool in C# with Visual Studio 2015 that queries a webserver and need authentification against a IBM webseal. Therefor I read in the internet it is possible to do the authentification with a HttpBaseProtocolFilter. But I cannot use it in my program as there is an error. "The Type- or namespacename 'HttpBaseProtocolFilter' was not found (missing using or assembly directive?)"
The documentation under https://learn.microsoft.com/en-us/uwp/api/windows.web.http.filters.httpbaseprotocolfilter says
Namespace: Windows.Web.Http.Filters
Assemblies: Windows.Web.Http.Filters.dll, Windows.dll
But I cannot find it in the IDE under - (hope I translated it correctly).
Hope you got a hint where to look for it.

Identify the ASP.NET version of a site

I debug a site. I need to identify the .NET and ASP.NET version of the running site (on a local IIS).
When I have an .NET Error, the a page is displayed, like this:
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a
configuration file required to service this request. Please review the
specific error details below and modify your configuration file
appropriately.
Parser Error Message: Unrecognized attribute 'requestValidationMode'.
Note that attribute names are case-sensitive.
Source Error:
Line 120: Line 121: Line
122: Line 123: Line
124:
Source File: C:\mysite\opt\root\web.config Line: 122
Version Information: Microsoft .NET Framework Version: 4.0.30319;
ASP.NET Version: 4.6.1038.0
Is there a way to obtain that data in other way than a error message, to be able to identify that versions at demand?
I would like to stress that .NET and ASP.NET are different, and I need both of them.
PS. I would prefer, if possible do not have to modify the code, but rather via IIS...
You can try either of this below
typeof(Page).Assembly.GetName().Version; //ASP.NET Version
This gives your running ASP.NET version which in my case 4.0.0.0. You can find the same information if you expand your Reference folder -> find System.Web dll -> right click and choose properties -> check the Version information.
System.Environment.Version.ToString(); //Framework Version
This gives the version information of the CLR.
.NET Framework - registry check?
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx
Environment.Version
should give you the ASP.NET version

Error debugging unit test in VS 2013 using Resharper

I am trying to debug a nunit unit test using Resharper in Visual Studio 2013.
I can run the test successfully although when I attempt to debug the test inside VS using Resharper I get the below warning msg.
"Microsoft WCF Service Host"
"The target assembly contains no service types. You may need to adjust the Code Access Security policy of this assembly."
The test does not fail and Visual Studio said it is "Running" although no break points are hit (in the test) nor does it throw any kind of exception or error.
Has anyone encounter this and know what a solution is?
Found the answer for anyone else interested.
How can I get rid of the "The target assembly contains no service types" error message in VS2008?
I had 1 project in a solution of around 90 which had the WCF Option enabled.

Importing workitem to TFS, work item type not found

I'm looking at this MSDN page but the code breaks on the line
WorkItemType workItemType = teamProject.WorkItemTypes["User Story"];
with the error
An unhandled exception of type
'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemTypeDeniedOrNotExistException'
occurred in Microsoft.TeamFoundation.WorkItemTracking.Client.dll
Additional information: TF201077: The work item type User Story cannot
be found. It may have been renamed or destroyed.
Where/what exactly should "User Story" be?
Do I need to import an XML document to my solution? Is the TFS server I'm connecting to not configured right for the way I'm trying to access it?
Which Template are you using? on your TFS Team Project.
As stated in that web page you need to be using
For example, you might create a user story as defined in MSF for Agile
software development for Visual Studio ALM.

Categories