Json Provider fails with Illegal characters in path - f#-data

I am using the FSharp Json Provider.
I am deploying to an Azure Web App.
When I deploy to Dev, it works fine.
When I deploy to TEST, it fails with the following message:
{"Message":"An error has occurred.","ExceptionMessage":"Illegal
characters in path.",
"ExceptionType":"System.ArgumentException","StackTrace":" at
System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String
fullPath)\r\n at System.IO.FileStream.Init(String path, FileMode
mode, FileAccess access, Int32 rights, Boolean useRights, FileShare
share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES
secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath,
Boolean checkHost)\r\n at System.IO.FileStream..ctor(String path,
FileMode mode, FileAccess access, FileShare share)\r\n at
FSharp.Data.Runtime.IO.asyncRead#237-5.Invoke(Unit unitVar) in
C:\Git\FSharp.Data\src\CommonRuntime\IO.fs:line 237\r\n
The type is genertated by
type Entities = JsonProvider<"./someDir/Sample.json">
and the error is generated here
let response = Entities.Load(currentUri)
I tried removing the file and in-line the sample json when I generate the type, but that also fails with the same error code.
Anyone have any ideas? Is it the currentUri? It is the same across all environments

I let it go and went with web client and newtonsoft.

Related

What is going wrong with web deployment from Visual Studio and App service?

Suddenly Web Deployment started failing.
Could not find file 'D:\home\site\wwwroot\App_Offline.htm'.
I stopped the service, but deployment still fails.
When I tried to delete any file from wwwroot in Kudu PowerShell UI I get error "404 file not find", but that file is still displayed after refresh.
When I tried to delete file directly in powershell I get error
Cannot remove item D:\home\site\wwwroot\Azure.Storage.dll: Invalid access to memory location.
At line:1 char:1
+ del .\Azure.Storage.dll
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (D:\home\site\wwwroot\Azure.Storage.
dll:FileInfo) [Remove-Item], IOException
+ FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell
.Commands.RemoveItemCommand
I deleted the service, recreated it and the first deployment from Visual Studio was Ok. But next day deployment failed again. The only thing between that deployments was deployment from VSTS. But I was able to deploy from VSTS and from Visual Studio in any order before without any problem.
I'm the Owner of that App Service.
Deployment log.
(2018-08-06 13:05:03) An error occurred when the request was processed on the remote computer.
Could not find file 'D:\home\site\wwwroot\App_Offline.htm'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
at System.Xml.XmlWriterSettings.CreateWriter(String outputFileName)
at System.Xml.XmlWriter.Create(String outputFileName, XmlWriterSettings settings)
at Microsoft.Web.Deployment.AppOfflineRuleHandler.AddAppOfflineFilesToEachApp(DeploymentBaseContext baseContext, Boolean whatIf)
at Microsoft.Web.Deployment.AppOfflineRuleHandler.AddChild(DeploymentSyncContext syncContext, DeploymentObject destinationParentObject, DeploymentObject& sourceObject, Boolean& proceed)
at Microsoft.Web.Deployment.DeploymentSyncContext.HandleAddChild(DeploymentObject destParent, DeploymentObject sourceObject, Int32 position)
at Microsoft.Web.Deployment.DeploymentSyncContext.SyncDirPathChildren(DeploymentObject destRoot, DeploymentObject sourceRoot)
at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildren(DeploymentObject dest, DeploymentObject source)
at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenNoOrder(DeploymentObject dest, DeploymentObject source)
at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildren(DeploymentObject dest, DeploymentObject source)
at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenNoOrder(DeploymentObject dest, DeploymentObject source)
at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildren(DeploymentObject dest, DeploymentObject source)
at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)
at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildren(DeploymentObject dest, DeploymentObject source)
at Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject, DeploymentObject sourceObject)
at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable, ContentRootTable contentRootTable, Nullable`1 syncPassId, String syncSessionId)
at Microsoft.Web.Deployment.DeploymentAgent.HandleSync(DeploymentAgentAsyncData asyncData, Nullable`1 passId, String user, String siteName)
Publish failed to deploy.
All of a sudden VSTS default deployment mode became Run-From-Zip.
The solution is setting Select deployment method checkbox in VSTS deploy and be sure Web Deploy is selected.
To "unlock" the service you need to delete setting WEBSITE_RUN_FROM_PACKAGE from Application settings page in the Azure Portal - it is under 'Configuration'
I hade the same problem today with net core 2.2 and the solution was to remove setting "WEBSITE_RUN_FROM_PACKAGE" in azure appsettings
We got hit by this same issue - the file system becomes readonly when WEBSITE_RUN_FROM_PACKAGE=1. Azure App Service seems to be adding this app setting automatically during recent platform upgrades.
I do suggest using Run-From-Package over web deploy - but you can easily revert their forced updates by setting WEBSITE_RUN_FROM_PACKAGE=0. If you are on Azure DevOps - the latest version of App Service Deploy v4 supports Run-From-Package.
Go to Configurations -> Application settings in your azure portal change the value of 'WEBSITE_RUN_FROM_PACKAGE' from '1' to '0'. And then publish again.
This resolved my problem.
The reason for this is because the AzureWebApp task in Azure DevOps (VSTS) Pipeline, updates the 'WEBSITE_RUN_FROM_PACKAGE' to '1'. This is primarily used by Azure Functions, where we need to deploy the entire package (and there by making the wwwroot as read-only). While its very useful in Functions, you will see weird things in normal Web App (such as App_Offline not found, the wwwroot/lib folder not found, you will see older files in the FTP folder but latest ones in the Kudu console etc).
The simplest fix is to update the setting 'deploymentMethod' to 'zipDeploy' in your YAML file.
Delete the appp settings WEBSITE_RUN_FROM_ZIP then retry deploy from VS. This worked for me
If you choose the deployment method by yourself in the release step this should not appear:
For those who cannot find setting in azure portal, please refer below steps.
Login to portal
Goto your app
search configuration
Name 'WEBSITE_RUN_FROM_PACKAGE' will be there is list.
My deployment was failing with the same message and stack trace, but was caused by a policy assignment that disallowed the location for my resource.
(The resource had been created in US West, and then a policy was applied at the tenant root level that only allowed US West 2.)
After the policy was updated, the deployment succeeded.
I got a similar error but for me it was:
Access to the path 'C:\home\site\wwwroot\App_Offline.htm' is denied
Got this when trying to publish a .NET 5 application. Fixed by setting correct .NET version in General settings for my App Service:
This error can occur when VS has issues finding your swagger xml file.
Right-click your project > Properties > Build will take you to the correct page.
Check the "XML Documentation File:" box. This resolved the issue for me but you may need to ensure that the release or debug folder are included in the path. i.e. bin\Release\ProjectName.xml or similar

What could cause EvoPDF "unable to render html" exception when deployed to Azure Website

Using EvoPDF for a .Net web application works locally, however once deployed to a Microsoft Azure website it throws a generic exception: "unable to render html".
Stack trace:
[Exception: Could not render the HTML string.]
EvoPdf.HtmlToImageConverter.ᜀ(String A_0, String A_1, String A_2, ᜴& A_3, Hashtable& A_4) +2129
EvoPdf.HtmlToPdfConverter.ᜀ(String A_0, String A_1, String A_2, String A_3, Boolean A_4) +8369
EvoPdf.HtmlToPdfConverter.ᜀ(Stream A_0, String A_1, String A_2, String A_3, String A_4, Boolean A_5) +58
EvoPdf.HtmlToPdfConverter.ᜁ(String A_0, String A_1, String A_2, String A_3, Boolean A_4) +126
EvoPdf.HtmlToPdfConverter.ConvertHtml(String htmlString, String baseUrl, String internalLinksBaseUrl) +33
EvoPdf.HtmlToPdfConverter.ConvertHtml(String htmlString, String baseUrl) +12
td.Printing.Labels.Print.WithEvoPdf(HttpContext httpContext, Action`1 htmlPageRenderer, String outputFileName, Label labelFormat) in C:\...\Evo PDF Print Labels.vb:54
td.OL3016WR.Render(HtmlTextWriter writer) in C:\...\OL3016WR.aspx.vb:166
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8921
You've hit an Azure App Service sandbox runtime exectution limitation.
From https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#unsupported-frameworks:
Unsupported frameworks
Here is a list of frameworks and scenarios that have been found to be not be usable due to one or more of the restrictions above. It's conceivable that some will be supported in the future as the sandbox evolves.
PDF generators failing due to restriction mentioned above:
EVOPDF
Rotativa
wkhtmltopdf
Syncfusion
Siberix
NReco (uses wkhtmltopdf)
Spire.PDF
Other scenarios:
PhantomJS/Selenium: tries to connect to local address, and also uses GDI+.
As you already mentioned this works fine in a Web/Worker Role (Cloud Services).
Service Fabric or IaaS VM are other options.
EvoPdf has a solution for Azure Websites. Check the http://www.evopdf.com/azure-html-to-pdf-converter.aspx page for more details.
Found the general cause. Something about EvoPDF is not compatible with Azure websites. In a cloud services web role it works OK.
I dissed Debenu unjustly. Ended up I was having problem with kernel32 LoadLibrary on the azure server. On my local machine it would take a relative path and find the dll. On azure I had to give it full path and it ran fine. Did not try the gdi+ renderer but 2, cairo worked fine.
To be compliant and provide an answer make sure you send a full path to loadLibrary and choose renderer 2. All good.

Unable to FTP into Azure web app

This problem first came about when I learned that a client of ours was running into permission errors on their site.
[IOException: The media is write protected.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +11804343
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +1326
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +60
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync) +54
System.Xml.XmlWriterSettings.CreateWriter(String outputFileName) +155
System.Xml.XmlWriter.Create(String outputFileName, XmlWriterSettings settings) +23
System.Xml.Linq.XDocument.Save(String fileName, SaveOptions options) +116
Umbraco.Core.Services.ApplicationTreeService.LoadXml(Action`1 callback, Boolean saveAfterCallback) +202
Umbraco.Core.Services.ApplicationTreeService.Intitialize(IEnumerable`1 existingTrees) +68
Umbraco.Web.Trees.ApplicationTreeRegistrar.ScanTrees(ApplicationContext applicationContext) +667
Umbraco.Web.Trees.ApplicationTreeRegistrar.ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) +9
Umbraco.Core.ApplicationEventHandler.OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) +37
Umbraco.Core.CoreBootManager.<Complete>b__5(IApplicationEventHandler x) +19
Umbraco.Core.EnumerableExtensions.ForEach(IEnumerable`1 items, Action`1 action) +141
Umbraco.Core.CoreBootManager.Complete(Action`1 afterComplete) +94
Umbraco.Web.WebBootManager.Complete(Action`1 afterComplete) +38
Umbraco.Core.UmbracoApplicationBase.StartApplication(Object sender, EventArgs e) +154
Umbraco.Core.UmbracoApplicationBase.Application_Start(Object sender, EventArgs e) +9
[HttpException (0x80004005): The media is write protected.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9966013
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +352
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): The media is write protected.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9947380
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261
So I tried to connect to the server with
ftp://waws-prod-bay-###.ftp.azurewebsites.windows.net
to troubleshoot the issue. Unfortunately, it errored out with the following message.
Can't connect to 'waws-prod-bay-###.ftp.azurewebsites.net' on port 21. Check the server name and proxy settings. If the settings are correct, the server may be temporarily unavailable.
So I tried creating a second ftp user, since the current one wasn't shown in the FTP/DEPLOYMENT USER field underneath the app's properties. This failed too.
Then I tried downloading the publish settings and used the credentials in there. No luck.
Lastly, I tried creating a new a new app to see whether it was a problem for all apps on the account or just the one. While it took much longer than usual to initialize, I was able to ftp into it once it was done.
Any ideas on what the problem is? I had found this, which lead to
this which says the problem (or a similar one at least) was resolved about 8 months ago.
Thanks for the help.
Edit:
I am able to ftp now, but I'm not going to flag this as resolved, since I don't know what fixed it. If anyone encounters this issue, please try juvchan's suggestion in the comments.
I would recommend trying the following to gain access
The simplest thing to try would be to restart the app in the portal. I've seen this same issue and restarting the app fixes it.
If that does not work, try actually resetting the deployment credentials rather than adding a new user.
To reset your deployment credentials go to the web app blade, click on All Settings -> Deployment Credentials. It will then let you reset the username AND password. Again; I have seen this as an issue too.

RavenDB interface runs on Pipelight but can't authenticate in linux?

I have strange problem. Unfortunately i have to use RavenDB and the local machine is linux. Thankfully i managed to install some silverlight support by using Pipelight and it seems to work ok.
Jut one thing doesn't work at all.
When i open the database interface, it loads in, shows my documents but when i need to authenticate and it opens the authentication window, it simply doesn't pass the authentication. Or as it seems to me, it even doesn't pass username and password further to the server at all.
(of course, i tested on windows from Internet Explorer and it works OK)
This is the error that i get:
Could not authenticate against the server
Message: [HttpWebRequest_WebException_RemoteServer]
Arguments: NotFound
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.1.20513.0&File=System.Windows.dll&Key=HttpWebRequest_WebException_RemoteServer
Uri: /edit?id=asdf&database=test
Server Uri: http://asdfasfd/databases/asdfasdf/docs/asdfadf
-- Error Information --
System.Net.WebException: [HttpWebRequest_WebException_RemoteServer]
Arguments: NotFound
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.1.20513.0&File=System.Windows.dll&Key=HttpWebRequest_WebException_RemoteServer
at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Func`2.Invoke(T arg)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise)
Inner StackTrace:
at Raven.Studio.Infrastructure.InvocationExtensions.Catch(Task parent, Action`1 action)
at Raven.Studio.Models.EditableDocumentModel.SaveDocumentCommand.SaveDocument()
at Raven.Studio.Models.EditableDocumentModel.SaveDocumentCommand.Execute(Object parameter)
at System.Windows.Controls.Primitives.ButtonBase.ExecuteCommand()
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)

Azure HTTPS Endpoint Local Debug Crash w/ "Error Attaching the Debugger"

I'm on Windows 7 Enterprise, Azure SDK 2.0, Azure Web Role Project in VS2012.
As soon as I add an https endpoint in the endpoints section of my Azure Cloud Project properties, I immediately get the following error:
There was an error attaching the debugger to the role instance. Unable to attach. The object invoked has disconnected from its clients.
As soon as i remove the https endpoint, or change the enpoint type to http, everything works. I have also tried running https on ports greater than 1000+, still no good.
It deploys to live fine, and the certificates are obviously then all good.
Any ideas?
Edit
My IISConfigurator.log looks like so:
IISConfigurator Information: 0 : [00000908:00000005, 2013/08/02 23:16:52.448, INFO ] Adding binding 127.255.0.0:82: to site deployment20(284).Widget.AzureProjV2.Widget.Web_IN_0_Web
IISConfigurator Information: 0 : [00000908:00000005, 2013/08/02 23:16:52.448, INFO ] Adding binding 127.255.0.0:446: to site deployment20(284).Widget.AzureProjV2.Widget.Web_IN_0_Web
IISConfigurator Information: 0 : [00000908:00000005, 2013/08/02 23:16:53.211, ERROR] Caught exception
IISConfigurator Information: 0 : [00000908:00000005, 2013/08/02 23:16:53.213, ERROR] Exception:System.Runtime.InteropServices.COMException (0x800401F3): Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))
Server stack trace:
at Microsoft.Web.Administration.Interop.IAppHostProperty.get_Value()
at Microsoft.Web.Administration.ConfigurationElement.GetPropertyValue(IAppHostProperty property)
at Microsoft.Web.Administration.Binding.get_CertificateHash()
at Microsoft.Web.Administration.BindingCollection.Add(Binding binding)
at Microsoft.WindowsAzure.ServiceRuntime.IISConfigurator.WasManager.DeploySite(String roleId, WASite roleSite, String appPoolName, String sitePath, String iisLogsRootFolder, String failedRequestLogsRootFolder, List`1 bindings, List`1 protocols, FileManager fileManager, WAAppPool defaultAppPoolSettings, String roleGuid, String& appPoolSid, List`1 appPoolsAdded, String configPath)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.WindowsAzure.ServiceRuntime.IISConfigurator.WasContainer.DeploySite(String roleId, WASite roleSite, String appPoolName, String sitePath, String iisLogsRootFolder, String failedRequestLogsRootFolder, List`1 bindings, List`1 protocols, FileManager fileManager, WAAppPool defaultAppPoolSettings, String roleGuid, String& appPoolSid, List`1 appPoolsAdded, String configPath)
at Microsoft.WindowsAzure.ServiceRuntime.IISConfigurator.IISConfigurator.Deploy(String roleId, WebAppModel webAppModel, String roleRootDirectory, String sitesDestinationRootDirectory, String diagnosticsRootDirectory, String roleGuid, String configPath)
IISConfigurator Information: 0 : [00000908:00000007, 2013/08/02 23:16:57.399, INFO ] Clean operation called over WCF interface with prefix 'deployment20(284)'
In what will now make the 4th time i've fixed an azure "attaching the debugger" error (for all different reasons) with this process, here is how you fix this.
Actually, my experience is proving this is how you fix EVERY "attaching the debugger" error.
Download the latest ver of Azure SDK if you're not latest
Remove your azure proj from your solution
Make an entirely new cloud/azure proj in solution
Copy the settings from your old proj into the new one (but not by copy/pasting the whole cscfg/csdef files-- theres azure-version-specific stuff in there. Only copy specific lines you need.)

Resources