You are viewing limited content. For full access, please sign in.

Question

Question

Adding WF Web Service Reference to Visual Studio project fails

asked on June 10, 2021

We had a customer recently upgrade from LF 10.2 to LF 11.  During the upgrade they also moved to a new server.  They have several VS projects that use the /Workflow/api/ web services and since the server move, they have to update their projects to the new server.  Originally, they got an error that the authentication was invalid because anonymous authentication was disabled.  The enabled anonymous authentication and then they get an error that the "Metadata contains a reference that cannot be resolved: 'http://workflowserver/Workflow/api/RestWorkflowAPI.svc'.".  I tested on my Demo system and get the same errors.  Originally, I got the error for anonymous authentication and then after enabling it in IIS, I get the same error about the reference cannot be resolved.  Below are screenshots from my Demo machine of the config and the error.

The HTML document does not contain Web service discovery information.
Metadata contains a reference that cannot be resolved: 'http://desktop-a5ti2dh/Workflow/api/RestWorkflowAPI.svc'.
The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<!DOCTYPE html> <!--[if !(IE 6) | !(IE 7) | !(IE 8)  ]><!--><html lang=en-US class=no-js> <!--<![endif]--><head><link rel=stylesheet href=https://www.laserfiche.com/wp-content/cache/minify/a1063.default.include.f26483.css media=all> <script type=application/ld+json>{"@context":"https://schema.org","@type":"WebSite","url":"https://www.laserfiche.com/","potentialAction":{"@type":"SearchAction","target":"https://www.laserfiche.com/Search/Index?q={search_term_string}","query-input":"required name=search_term_string"}}</script> <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"><meta name="theme-color" content="#e35205"><link rel=profile href=https://gmpg.org/xfn/11> <script>if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){var originalAddEventListener=EventTarget.prototype.addEventListener,oldWidth=window.innerWidth;EventTarget.prototype.addEventListener=function(eventName,eventHandler,useCapture)'.
If the service is defined in the current solution, try building the solution and adding the service reference again.

 

0 0

Replies

replied on June 11, 2021

Is your project targeting .Net 4.8? Are there any IIS redirects possibly getting in the way?

Could you open a support case and attach a log of failed requests from IIS so we can get a better idea of what's going on?

0 0
replied on June 11, 2021

The program is targeting .NET 4.7.2.

I did not add any redirects, so if there are any redirects, they are coming from the Workflow API site.

I added and turned on IIS Failed Request Tracing

I rebooted the PC just to be sure, but after trying to add the Service Reference to the VS project and getting the error, there is no file created for the failed request tracing.

The standard IIS log contains the following:

#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2021-06-11 17:24:06
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2021-06-11 17:24:06 fe80::51f0:cd9a:7aea:51e6%14 POST /workflow/api/RestWorkflowAPI.svc - 80 - fe80::51f0:cd9a:7aea:51e6%14 - - 405 0 1 12
2021-06-11 17:24:06 fe80::51f0:cd9a:7aea:51e6%14 GET /Workflow/Home/BrowserSuggestion - 80 - fe80::51f0:cd9a:7aea:51e6%14 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.42000) - 200 0 0 496
2021-06-11 17:24:06 fe80::51f0:cd9a:7aea:51e6%14 GET /Workflow/Home/BrowserSuggestion - 80 - fe80::51f0:cd9a:7aea:51e6%14 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.42000) - 200 0 0 483
2021-06-11 17:24:06 fe80::51f0:cd9a:7aea:51e6%14 POST /workflow/api/RestWorkflowAPI.svc/mex - 80 - fe80::51f0:cd9a:7aea:51e6%14 - - 404 0 0 190

 

0 0
replied on July 21, 2021

Hi Bert, did you find any solution for this issue?

0 0
replied on July 21, 2021 Show version history

They instructed us to build the project targeting .NET 4.8.  We did this and that got rid of the "The HTML document does not contain Web service" error message, but then received a new permission denied error that we still have not been able to get around.

1 0
replied on November 1, 2023

I have hit this issue recently when working on create web reference over the WF 11. 

The error message as:

The HTML document does not contain Web service discovery information.
Metadata contains a reference that cannot be resolved: 'http://win2016/workflow/api/RestWorkflowAPI.svc'.
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM,Negotiate'.
The remote server returned an error: (401) Unauthorized.
If the service is defined in the current solution, try building the solution and adding the service reference again.

 

I have another LF 9.2 workflow server just working fine. I clearly remember when I have Laserfiche 10.4 has no issue as well. Now after upgrade to 11.
I have compare the web.config/IIS settings/Apppool etc. doesn't see any difference between my LF 11 vs LF 9.2 workflow webservice. Just so strange it suddenly not working.

Screenshot 2023-11-01 114905.jpg
0 0
replied on November 1, 2023 Show version history

Luke,

First verify two things:

  1. That in a browser https://yourWFserver/Workflow/api/RestWorkflowAPI.svc returns this page: 
  2. and that https://yourWFserver/Workflow/api/RestWorkflowAPI.svc?wsdl and https://yourWFserver/Workflow/api/RestWorkflowAPI.svc?singleWsdl return XML docs like:

 

In Visual Studio 2022, I successfully added the Service Reference using URI https://yourWFserver/Workflow/api/RestWorkflowAPI.svc. I received two auth prompts, entered my AD credentials in "domain\username" format for each, and then the reference loaded. I'm guessing the first auth prompt was for IIS and the second for the WCF authorization pipeline.

I did not change any IIS authentication/authorization settings.

I also tested against a different Workflow server where for whatever reason https://yourWFserver/Workflow/api/RestWorkflowAPI.svc and ?wsdl and ?singleWsdl threw HTTP 404 errors in the browser and those 401 Unauthorized errors in Visual Studio. If that's your case, I'm not exactly sure how to fix it. If you can, try repairing and uninstalling/reinstalling Workflow.

I haven't tested on earlier versions of Visual Studio.

Microsoft has some articles from some years ago that discuss a "WCF Service Reference tool in the VS Marketplace" that provided auth functionality for WCF MEX refernces but the extension seems to no longer exist. That I got auth prompts in VS 2022 suggests that MSFT may have built the capability in. You may still find some of the info here useful:

 

I've also attached the "singleWsdl" output from Workflow 11 in case that's helpful. Remove the ".txt" and update the "http://workflowserverFQDN.example.com/Workflow/api/RestWorkflowAPI.svc" value at the end to your actual Workflow server address:

<wsdl:port name="BasicHttpBinding_IWorkflowAPIBase" binding="tns:BasicHttpBinding_IWorkflowAPIBase"><soap:address location="http://workflowserverFQDN.example.com/Workflow/api/RestWorkflowAPI.svc"/></wsdl:port></wsdl:service></wsdl:definitions>

 

1 0
replied on November 1, 2023

Thank you Samuel for detail instruction. 
For step 1 I have same result as you have. 

The problem come with using VS add "Service reference" via svc. It works fine for my early version Laserfiche VM (9.2,10.4) but not success on v11. I had tried via VS2017, VS2019, VS2022, all not working and return exact same error message. Using the command line "SvcUtil.exe" as per the first image show, got the same error.

 

Regarding your second step add via VS2022, it didn't pop up dialog for credential -- again this happened without change anything for IIS and it's default Workflow installation.

I will check other links in your reply to get some more hints.

 

BTW, it's not just happens to my VM(Laserfiche), I asked one of my colleague to test on his VS -> LFWF 11, he got the same error. 

Screenshot 2023-11-01 175344.jpg
0 0
replied on November 1, 2023 Show version history

What project type/template are you using? I used "WCF Service Application" with .NET Framework 4.8.1 in my successful test.

https://learn.microsoft.com/en-us/visualstudio/data-tools/how-to-add-update-or-remove-a-wcf-data-service-reference?view=vs-2022

In the Address box, enter the URL for the service, and then click Go to search for the service. If the service implements user name and password security, you may be prompted for a user name and password. 

I received said prompt.

I just tried with a .NET 6 project, chose the WCF Service Reference options, got one auth prompt, and it worked:

Then I tried adding the reference by Browsing for the WSDL file (downloaded/saved from https://yourWFserver/Workflow/api/RestWorkflowAPI.svc?singleWsdl and given .wsdl file extension):

Since you are able to get the WSDL in the browser, if your project can be .NET 6/8 rather than .NET Framework, maybe try the file upload method instead.

0 0
replied on November 1, 2023

Unfortunately the development project needs on .NET Framework so targeting on .Net (Core) isn't an option.

Regarding use .NET Framework 4.8.1 which isn't support for my Windows Server 2016. However, even I create the project on my Server 2022/Visual studio 2022 on 4.8.1, the same result.

I even try build a .NET (core) application and can see all the options, it still not be able bypass the error message from LF WF 11 Service -- definitely something on the LF WF 11. I can't do a fresh installation of WF server/service as I had a bunch of workflows there. The only option would be back up my VM and test on a copy. I will see if I can get one fresh new Workflow server 11. Just too much hassle when it should be a simple task. :-(

 

Screenshot 2023-11-01 231206.jpg
0 0
replied on November 1, 2023

Further try your suggestion to upload the wsdl (I named it .xml though) and get following errors:

---------------------------------------------------------------------------------

The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
Cannot import wsdl:port\r\nDetail: \r\nXPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='RestWorkflowAPI']/wsdl:port[@name='BasicHttpBinding_IWorkflowAPIBase']
Cannot import wsdl:binding\r\nDetail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.\r\nXPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IWorkflowAPIBase']\r\nXPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='BasicHttpBinding_IWorkflowAPIBase']
Cannot import wsdl:portType\r\nDetail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter\r\nError: Schema with target namespace 'http://tempuri.org/' could not be found.\r\nXPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IWorkflowAPIBase']
---------------------------------------------------------------


 

Screenshot 2023-11-01 231905.jpg
0 0
replied on November 2, 2023

Re:

Regarding use .NET Framework 4.8.1 which isn't support for my Windows Server 2016.

You should be able to simply install the latest .NET Framework 4.8.1 runtime on the 2016 server. Server 2016 doesn't include .NET Framework 4.8.1 out of the box, but it definitely supports it.

Re:

Further try your suggestion to upload the wsdl (I named it .xml though) and get following errors:

Did you give it the "wsdl" or "singleWsdl" file? The non-404 import errors potentially suggest it had the former, and I think you need the latter. 

1 0
replied on November 2, 2023

Hi Samuel, thank you for all the help.
I end up re-install the Workflow and surprisingly seeing it works after that!

I don't know what cause the issue -- probably during the upgrade (from 4.3 -> 11) or later applied some updates/patch cause it broke?

Anyway, glad you give me a lot of suggestions and definitely helpful for future diagnosis if similar thing happens.

 

1 0
replied on November 2, 2023 Show version history

To be more precisely, I am glad to see when re-install Workflow there are actually selection of which components to re-install, In my case, I just re-install "web service" portion and vola, my issue is gone after that.

0 0
replied on November 2, 2023

Glad to hear it solved the VS issue! But make sure you have the other Workflow components that should be on that server selected as well. The component selector is best understood as defining the state: unchecked components will be uninstalled if they already exist. 

Workflow's configuration files are preserved through an uninstall, so you can re-run the installer (select Modify) to add the Workflow Designer/Service/Subscriber/etc. components back and they should (mostly) pick up the previous configurations.

1 0
replied on November 2, 2023

You're totally right! I shouldn't uncheck all other components! but strange it still pick the web service when other components not there?

I'll delete the attached screenshot just in case people don't know what it is meaning.

(I worked late last night and forget to check if I "uninstall" wf designer etc.  My bad.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.