Introduction to Azure Function
- Azure Subscription
- Visual Studio 2017
Even if you publish it, it will work smoothly. However, if you want to debug the Azure Function on your local, unlike the initial old days using Azure CLI, you will get the below error in the Azure CLI window.
A ScriptHost error has occurred,
[2/26/2019 10:48:26 AM] Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1.Run'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'log' to type TraceWriter. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
[2/26/2019 10:48:26 AM] Error indexing method 'Function1.Run',
Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1.Run'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'log' to type TraceWriter. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).

Solution
The Reason behind the error is, the latest Microsoft.Net.SDK.Functions after “1.0.11” has lots of bugs for Azure function v1 upon which Microsoft is barely working as they are recommending the hardcore .net framework developer to use Azure Function v2 (.net Core). However, it works smoothly with version V2.

The workaround
- Expand/Open Solution Explorer
- Right click on Solution
- Click on Manage NuGet Packages for solutions (Alternatively, you can also you package manager in case if you are good at it)
- Under the installed section in NuGet Window, select “Microsoft.NET.Sdk.Functions” package
- In the right side, select the version from Versions Dropdown “10.0.11”

- Click on “Update” button
- Check the Preview Changes Dialog and click on “OK”
- Accept the License and Agreement
- Wait for a while until the packages get updated. Check that the installed Version is set to “10.0.11”
Once you Hit the F5 or use start debugging Menu from the Menu Ribbon:

http://localhost:7071/api/Function1
http://localhost:7071/api/Function1?name=UmeshMurumkar,


Join the conversation! Your thoughts help the community grow.