Closed pauldalyii closed 7 years ago
Probably because it hasn't been implemented yet :) But this is a good place to track adding it.
Fair enough :) Do you have a rough idea on when it might be available - even if just in preview - so I can try again then?
I just pushed a change to support --useHttps
The behavior is a bit different from V1.
In V1 I was using Window APIs for auto generating a random cert. I need to have a better flow for cross plat, but for now you need to pass --cert <cert.pfx> --password <password or file with password>
it should print instructions if you don't though. I'm hoping to eventually automate it (maybe) but for now this should unblock you.
and this is it working
I just pushed it to npm, so you can run npm i -g azure-functions-core-tools@2.0.1-beta.11
to get it.
Thanks @ahmelsayed!
I created the PFX using PowerShell. Since I was already in a command prompt, I just tried to launch the function app directly from there. The function app launched with the following:
%USERPROFILE%\AppData\Roaming\npm\func.cmd host start -port 7071 --useHttps --cors * --cert .\certificate.pfx --password "<password>"
However, when I trigger a function I get an exception I'd like to debug in VS.
I was able to debug in VS with the CLI 2.0 Preview before upgrading to 2.0.1-beta.11 by modifying the project config like this: This "worked" in that the CLI launched, the ASCII art displayed... but eventually it crashed due to the --useHttps flag.
After the upgrade to the CLI and after seeing the CLI start the function app from the command prompt, I assumed that I'd be able to debug it in VS similarly, by appending --cert .\certificate.pfx --password "<password>"
to the application arguments:
However, now I immediately get an error that says "The sytnax of the command is incorrect." The ASCII art doesn't even display.
Should I be debugging the function app differently with CLI 2.0?
I suspect the error I'm getting is related to .NET Standard 2.0 support, but I'm not sure. Here's the exception in case it is helpful to you.
[9/1/2017 12:52:16 AM] A ScriptHost error has occurred
[9/1/2017 12:52:16 AM] Exception while executing function: Applications. Service: Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
[9/1/2017 12:52:16 AM] Exception while executing function: Applications
[9/1/2017 12:52:16 AM] Exception while executing function: Applications. Service: Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
[9/1/2017 12:52:16 AM] Function completed (Failure, Id=20c37b66-9975-42a3-97aa-2a031d86a46f, Duration=49ms)
[9/1/2017 12:52:16 AM]
[9/1/2017 12:52:16 AM] Executed 'Applications' (Failed, Id=20c37b66-9975-42a3-97aa-2a031d86a46f)
[9/1/2017 12:52:16 AM] System.Private.CoreLib: Exception while executing function: Applications. Service: Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
[9/1/2017 12:52:16 AM] Function had errors. See Azure WebJobs SDK dashboard for details. Instance ID is '20c37b66-9975-42a3-97aa-2a031d86a46f'
[9/1/2017 12:52:16 AM] System.Private.CoreLib: Exception while executing function: Applications. Service: Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Thanks again for your help! Also, if it'd be easier to sort this out over a Skype session, I'd be happy to. My alias is padal.
/cc @fabiocav for the exception loading System.Net.Http.Formatting
regarding VS, the V1 cli was an executable, while the v2 cli is a dll, so far.
these 2 configurations work for me
Executable: C:\Program Files\dotnet\dotnet.exe
Application arguments: %USERPROFILE%\.azurefunctions\bin\Azure.Functions.Cli.dll host start --port 7071 --useHttps --cors * --cert "D:\temp\cert.pfx" --password "D:\temp\password.txt" --pause-on-error
Working directory: <>
I think the problem with specifying a cmd for VS is that they probably expect an executable rather than a shell script.
however, for whatever reason F5
debugging isn't working for me, I get this weird error from VS
But if I do CTRL+F5
then go Debug -> Attach to Process -> search for dotnet.exe
, debugging works fine for me.
Thanks @ahmelsayed!
I can launch with CTRL-F5
, and attach the debugger now.
However, after triggering the function I still see the exception I mentioned earlier in the CLI window. Also, my breakpoints in VS don't hit - even one in the constructor of the function.
@fabiocav Can you take a look at the assembly loading exception? I won't expect any of the function's code to be ran until all the dependencies have been loaded. @pauldalyii What packages are you referencing in your csproj?
@pauldalyii yeah, if you can provide a quick repro, we'll take a look at that.
Happy to provide a repro. How would you like me to share it? I'm an FTE (padal), so I can also do a Skype session if that's easier.
The function project directly references these packages: `
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="3.16.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.2" />
<PackageReference Include="Microsoft.Web.WebJobs.Publish" Version="1.1.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.0" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
`
But the function project also indirectly references other packages via 3 project references:
From Project 1:
<package id="Microsoft.Net.Compilers" version="2.3.1" targetFramework="net47" developmentDependency="true" />
,
Project 2:
`
and Project 3:
`
`
Basically, I have a function app project and a handful of data access projects that the function app project references.
hi @ahmelsayed, since https seems to be working now, would you like me to open a separate issue regarding the exception I'm seeing while trying to debug a function app referencing ef core 2.0?
@pauldalyii Yes please, that will make it easier to track
I just tried the CLI 2.0 Preview on a function app that uses EFCore 2.0.
The CLI shows the ASCII art, sit there for about 30 seconds and then shows the following error:
If I remove --useHttps, it works fine. If I use --useHttps using the 1.0.2 CLI, it also works fine.