I've an Azure Function that should read data from a file called schema.config
I've uploaded it on the portal as shown here
In my application I do
public static string GetSchemaFile()
{
string file = ConfigurationManager.AppSettings.Get("schemafile");
FileInfo fi = new FileInfo(file);
return fi.FullName;
}
And I've defined an application setting on Azure as
When I run the code I got this exception
Exception while executing function: Functions.blobfunction
Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: Functions.blobfunction ---> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation. ---> System.IO.DirectoryNotFoundException : Could not find a part of the path 'D:\Windows\system32\bin\schema.json'.
So it seems that it looks in D:\Windows\System32 as working folder...
How do I tell to look the file in the "bin" folder?
If you go to the Kudu console you can see your exact folder structure. Here's how to do that:
Click on your function app root node in Azure Portal (the one right below where it says "Function Apps" in the top left)
Click on "Platform Features" at the top
Click on "Advanced Tools (Kudu)" under "Development Tools" on the left hand side, this opens a new window/tab
Select CMD at the top under "Debug Console"
Navigate to site/wwwroot and you'll see all your projects
Select your project then the bin directory
The actual full path will then be displayed in the bottom part of the window, you can use that instead.
You may want to consider renaming the folder to something other than bin, traditionally that's where you put executable files.
Related
So I've come across a problem, what I am trying to do is "Check if the python file is ready to execute" as verbatim by my CS professor. So here I what I have done so far:
-Enabled Directory Browsing
-Added a new Script Map
-Linked the executable to the python executable of my python project
-Changed its directory to a new folder (as instructed)
-Created a New Python File with this code in it:
print("Content-Tytpe: text/html\n");
number1 = 1
while number < 10:
print("Hello Python World! <br>");
number = number+1
-and finally clicked on "Browse .80"
I clicked on "test.py" (the python file) and this showed up:
I researched a couple of fixes in this site and among others and this is what I have tried:
-Checked the permissions in the folder and made added a new permission for Everyone with Full Control Access
-Checked Authentication and Anonymous Authentication and set it to Application Pool Identity, both on the Desktop and the Default Website
-I even went to go as far as resetting my PC to check if some other third party application is affecting it
I am really at the end of my rope here so any help would be greatly appreciated.
Try to refer to the steps below.
In IIS, select your site -> Double click on Authentication -> Select Anonymous authentication-> Right-click on it and select Edit option.
Select a Specific user option. Set IUSR, click OK.
Go to the site folder-> open its properties-> go to Security tab-> Make sure IIS_USRS has Read & execute, List folder contents, Read permissions.
After that try to visit the page again.
If the issue persists, try to check whether you are able to visit any HTML file in that folder or not.
I just published my web app which has the following structure:
Project Name
StylesFolder
filename.css
anotherfile.css
JavaScriptFolder
bootstrap.js
Index.html
What I did was:
Adding a new WebSite in the server IIS with the path were I publish my WebApp (ex. C:\WebProjects\PublishedApp\Project Portal)
Selecting my published app and converting into an application (The alias name was Project Name and the physical path was C:\WebProjects\PublishedApp\Project Portal\Project Name)
The problem is when I try to see the website. I'm able to enter to 192.169.100.20:80/Project%Name/ and my index page is loaded (I can see the text, inputs, etc.) but I cannot see any stlye and javascript input and when I check the console logs all the files are getting a 404 error response.
When I check which URL is used by the files I can see that they are trying to get accessed by 192.169.100.20:80/Project Name/StylesFolder/filename.css etc...
So my question is what can I do to remove the /Project%Name/ string from the URL?
PD. I'm using IIS 7
When you add your website in IIS, select the application folder you published. For example, when you publish your application to D:\Program Files\Publish Folder, select the Publish Folder folder directly when adding the website and choose the physical path.
This is the reference:Deploy Website on IIS
My Azure Function works well if run from the browser
https://examplefunction.azurewebsites.net/api/HttpTrigger-Java?name=testEUR.txt&code=mycode
I configured the function to run as a stage in "Logic Apps" - hard-coding the "name" parameter for testing purposes
But then I get "Bad Request" when running the function via logic apps
This can be solved by adding "authlevel":"anonymous" to function.json which is in under site/wwwroot/examplefunction
Instructions to set the authentication level are as follows
select Platform features. Under Development tools, select Advanced tools (Kudu).
On the Kudu website's title bar, from the Debug Console menu, select CMD.
After the next page appears, from the folder list, select site > wwwroot > examplefunction.
Open the function.json file for editing.
In the bindings object, check whether the authLevel property exists. If the property exists, set the property value to anonymous. Otherwise, add that property and set the value.
Once this has been done, then in the Request body of the logic app, just putting "testEUR.txt" works
Obviously, a better answer would be one that does not seem to apparently disable authentication.
How to rename an Azure Function?
I want to replace a default 'HttpTriggerCSharp1' name to my own. At the moment unfortunately this name is included in the function url and there is no option to change it:
https://functions-xxx.azurewebsites.net/api/HttpTriggerCSharp1
The UI does not directly support renaming a Function, but you can work around this using the following manual steps:
Stop your Function App. To do this, go under Function app settings / Go To App Service Settings, and click on the Stop button.
Go to Kudu Console: Function app settings / Go to Kudu (article about that)
In Kudu Console, go to D:\home\site\wwwroot and rename the Function folder to the new name
Now go to D:\home\data\Functions\secrets and rename [oldname].json to [newname].json
Then go to D:\home\data\Functions\sampledata and rename [oldname].dat to [newname].dat
Start your function app, in the same place where you stopped it above
In the Functions UI, click the refresh button in the top left corner, and your renamed function should appear
Note: doing this can lose some historical logging.
Github Issue for renaming Azure Function
Edit for new info
To anyone like myself that arrived here looking to rename their function, despite this being the previously correct answer, there is now a much smoother CMD based process as detailed in this answer by SLdragon and an even smoother GUI based process detailed in this answer by Amerdeep below.
Now (2017.10) we can use console to rename the Azure Function name
Open the Console from your Function APP -> Platform features:
Rename the Function folder using command line:
Restart the Function:
Refresh
Create a new function and you will have an option to name it, then delete the default one(HttpTriggerCSharp1).
I know it's not renaming, but the easiest option around.
Go to Function Apps
Click on platform features
Click on app service editor
Right click on your default function name-select
Below worked for me.
I wanted to rename my azure function from "HttpTriggerCSharp1" to "my-new-func1"
Go to
Function Apps >
My-Function-App >
Platform Features TAB >
Console >
Run below commands:
cd D:\home\site\wwwroot
move HttpTriggerCSharp1 my-new-func1
Now restart the application:
Function Apps >
My-Function-App >
Overview TAB >
Restart
NOTE: The function 'code' query param changes by doing this.
I have a problem regarding the download of a ClickOnce application.
I have succesfully deployed my ClickOnce application to an IIS server. The ClickOnce files are in path on the IIS:
/MyApp/install
When i from another machine navigate to the standard publish page of the ClickOnce I can either click "launch" or install.
The difference is:
- "launch" URL is to ThisIsTheApplication.application file.
- install URL is to setup.exe file
When I click the launch file I can succesfully install the apllication. If I use the setup.exe it fails when i try executing that file.
The setup.exe basicly checks whether my prerequiteses are installed or not (only .NET 4.5 for this).
The log file says:
The following properties have been set:
Property: [AdminUser] = true {boolean}
Property: [InstallMode] = HomeSite {string}
Property: [NTProductType] = 3 {int}
Property: [ProcessorArchitecture] = AMD64 {string}
Property: [VersionNT] = 6.2.0 {version}
Running checks for package 'Microsoft .NET Framework 4.5 (x86 and x64)', phase BuildList
Reading value 'Version' of registry key 'HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full'
Read string value '4.5.51641'
Setting value '4.5.51641 {string}' for property 'DotNet45Full_TargetVersion'
The following properties have been set for package 'Microsoft .NET Framework 4.5 (x86 and x64)':
Property: [DotNet45Full_TargetVersion] = 4.5.51641 {string}
Running checks for command 'DotNetFX45\dotNetFx45_Full_x86_x64.exe'
Result of running operator 'ValueEqualTo' on property 'InstallMode' and value 'HomeSite': true
Result of checks for command 'DotNetFX45\dotNetFx45_Full_x86_x64.exe' is 'Bypass'
Running checks for command 'DotNetFX45\dotNetFx45_Full_setup.exe'
Result of running operator 'ValueNotEqualTo' on property 'InstallMode' and value 'HomeSite': false
Result of running operator 'VersionGreaterThanOrEqualTo' on property 'DotNet45Full_TargetVersion' and value '4.5.50709': true
Result of checks for command 'DotNetFX45\dotNetFx45_Full_setup.exe' is 'Bypass'
'Microsoft .NET Framework 4.5 (x86 and x64)' RunCheck result: No Install Needed
Launching Application.
URLDownloadToCacheFile failed with HRESULT '-2146697208'
Error: An error occurred trying to download 'https://myurl.com/MyAppFolder/install/ThisIsTheApplication.application'.
Why does the "launch" work and not the setup.exe?
I had the same problem here. My log file looked very similar (there were no stack traces or anything in it) and the last two lines were similar. The setup.exe failed, but the … .application URL worked ok. I'm on a corporate network/domain and our system administrators had set up a lot of group policies overriding the default security zone settings. The problem was solved by removing the policies and then clicking buttons:
“IE -> Tools -> Internet options -> Security -> Reset all zones to default level”
and “Advanced -> Restore advanced settings”.
I've found the following guide here:
http://feedback.veodin.com/knowledgebase/articles/52576-installation-fails-with-error-message-urldownload
Start Microsoft Internet Explorer by pressing Win+R, enter ‘iexplore’ and finally press enter
Go to ‘Tools’ Menu
Make sure to uncheck the mark at ‘Work Offline’
Execute KeyRocket_Setup.exe again
With that said, I think it's easier to create someone's own "clickonce" experience, in order to avoid any interference with Internet Explorer whatsoever.