Office Excel AddIn Custom Function Resource Download Error - excel

I used yo office to create a Excel AddIn with custom functions.
I made some changes based on following Configure your Office Add-in to use a shared JavaScript runtime to use shared runtime.
After starting the project, I am able to check the shared runtime is running by checking the go text. But my custom functions did not work. it shows #BUSY! all the time.
I checked the error in AppData\Local\Temp\OfficeAddins.log.txt. There is no helpful information,
only content below:
11/29/2021 15:42:15 Unexpected Resource The server for this resource is unavailable.
11/29/2021 15:42:15 Unexpected Resource The server for this resource is unavailable.
11/29/2021 15:42:15 Medium Resource Resource Download Error Details: SolutionId=af84c00e-1e75-43c8-b0b8-5e68d915dfa4 , AppVersion=1.0.0.0
11/29/2021 15:42:15 Medium Resource Resource Download Error Details: SolutionId=af84c00e-1e75-43c8-b0b8-5e68d915dfa4 , AppVersion=1.0.0.0
11/29/2021 15:45:55 Verbose CustomFunctions [Execution] [Async] [Begin] Function=CONTOSO11.ADD1, Workbook=Excel add-in af84c00e-1e75-43c8-b0b8-5e68d915dfa4.xlsx
Any help would be appreciated

I finally resolved my issue.
The problem turned out to be in the usage of localhost in manifest for the add-in. I changed my webpack-dev-server to listen on IP address of the desktop and use http protocol instead of https. After this change, the add-in registered in split second and I saw my custom function accessible in the sheet.
I originally tried to configure the local webserver to use "0.0.0.0" to listen to the network calls as well but apparently my company is not allowing any local servers running on the desktop to be accessed outside of the machine (local network) for security reasons therefore I chose the option to use the IP instead.
This is the devServer config entry in webpack I used:
devServer: {
host: "xx.xxx.xxx.xxx",
allowedHosts: "all",
hot: true,
headers: {
"Access-Control-Allow-Origin": "*",
},
port: 9000,
},
As I had said I also adjusted my manifest from https://localhost:3000 which is the default to use http://<IP of the host>:9000
https did not work well since the certs were not matching host's logical IP address.
My original problem was slightly different than yours although the error message was exactly the same. My add-in was not loading at all and it was taking over 25 seconds to get an error from Excel on failed add-in installation reporting failure to load a required resource.
These are the errors I spotted in my Add-in log (OfficeAddin.log.txt)n:
8/19/2022 16:09:37 Medium Resource Resource Download Error Details: SolutionId=05c2e1c9-3e1d-406e-9a91-e9ac648541c3 , AppVersion=1.0.0.6
8/19/2022 16:09:37 Unexpected Resource The server for this resource is unavailable.
The second challenge for custom functions executing properly was to configure shared runtime. There are two places in manifest + changes in webpack config.
Manifest:
1st place is right after <HOST> in main tag block
<Requirements>
<Sets DefaultMinVersion="1.1">
<Set Name="SharedRuntime" MinVersion="1.1"/>
</Sets>
</Requirements>
2nd place is right after <HOST xsi:type="Workbook"> and inside <Page> tag:
<Host xsi:type="Workbook">
<Runtimes>
<Runtime resid="Taskpane.Url" lifetime="long" />
</Runtimes>
<AllFormFactors>
<ExtensionPoint xsi:type="CustomFunctions">
<Script>
<SourceLocation resid="JS-URL" />
</Script>
<Page>
<SourceLocation resid="Taskpane.Url"/>
</Page>
<Metadata>
<SourceLocation resid="JSON-URL" />
</Metadata>
<Namespace resid="Functions.Namespace" />
</ExtensionPoint>
</AllFormFactors>
Webpack adjustments are covered in the link you hinted.

Related

ServiceFabric Warning "Endpoint with ExplicitPort is within application port range. This can cause port conflicts."

After updating my ServiceFabric cluster to version 6.5, a warning has started popping up for my applications.
Endpoint MyEndpoint with ExplicitPort 27000 is within application port range. This can cause port conflicts. Please select a port from outside application port range.
Why is this error happening and what do I need to do to fix it?
Starting with ServiceFabric 6.5CU2, ServiceFabric started to show warnings for these misconfigurations. These warnings might turn into errors in the future.
By design static ports should not overlap with application port range specified in the ClusterManifest. If you specify a static port, assign it outside of application port range, otherwise it will result in port conflicts. With release 6.5CU2 we will issue a Health Warning when we detect such a conflict but let the deployment continue in sync with the shipped 6.5 behaviour. However, we may prevent the application deployment from the next major releases.
(https://learn.microsoft.com/en-gb/azure/service-fabric/service-fabric-service-manifest-resources)
The application port range is cluster wide and is 20000-30000 by default.
You can change it e.g. via ARM template or https://resources.azure.com
"nodeTypes": [
{
"name": "nt",
...
"applicationPorts": {
"startPort": 20000,
"endPort": 30000
},
...
}
],
The static endpoint port can be configured in the servicemanifest.json of your service.
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest ...>
<Resources>
<Endpoints>
<!-- This endpoint is used by the communication listener to obtain the port on which to
listen. Please note that if your service is partitioned, this port is shared with
replicas of different partitions that are placed in your code. -->
<Endpoint Name="MyEndpoint" Protocol="http" Port="27000" PathSuffix="/xxx" UriScheme="http" Type="Input" />
</Endpoints>
</Resources>
</ServiceManifest>

HTTP Error 500.19 - Internal Server Error Error Code 0x80070021

I've installed an IIS server on windows 8 and plublished my first site, this is the error I get. Any help would be appreciated.
Detailed Error Information:
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x80070021
Config Error
This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
Config File
\?\C:\inetpub\wwwroot\ContractorScoping\web.config
Requested URL
http://localhost:80/ContractorScoping
Physical Path
C:\inetpub\wwwroot\ContractorScoping
Logon Method
Not yet determined
Logon User
Not yet determined
Config Source:
68: <validation validateIntegratedModeConfiguration="false" />
69: <modules>
70: <remove name="ApplicationInsightsWebTracking" />
Line 69 is the one highlighted in red
Schoolboy error, forgot to install asp.net on the server
This error comes due to missing IIS Packages. I solved the error with doing these steps:
Click "Start button"
in the search box, enter "Turn windows features on or off"
in the features window, Click: "Internet Information Services"
Click: "World Wide Web Services"
Click: "Application Development Features"
Check (enable) the features. I checked all but CGI.

FABRIC_E_INVALID_ADDRESS when contacting service fabric stateless service through remote proxy

I am getting a "FABRIC_E_INVALID_ADDRESS" 400 Bad Request when contacting my stateless service externally.
I have set up the reverse proxy exactly as it says in this article: https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-reverseproxy
I am contacting the service the same way it explains to in the documentation, with:
http://clustername.com:19008/MyApp/MyService
I am fairly confident the reverse proxy is working as intended, because the port 19008 returns a response from service fabric. Also:
If I strip MyService from the URL, I get a 404 SERVICE_DOES_NOT_EXIST
If I change the service name, I get a 404 SERVICE_DOES_NOT_EXIST
If I use another port, I get a timeout.
So it sees that the service exists, but returns the invalid address 400 error.
Are there any sort of diagnostics I can leverage? The main issue with this problem is all I have to go on is 400 FABRIC_E_INVALID_ADDRESS, which produces no google results other than a list of error codes with no descriptions from MSDN. There is nothing else in the response headers.
I had the same error but it begun to work when I added the UriScheme and Protocol attributes to the Endpoint in the ServiceManifest.xml Endpoints sections:
<Endpoint Name="Test1TypeEndpoint" UriScheme="http" Protocol="http" />
as I am deploying using Guest Containers, it will not work until you also add a Policiy in the ServiceManifestImport section of the ApplicationManifest.xml stating the port exposed by the docker container:
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="Test1Pkg" ServiceManifestVersion="1.0.0" />
<ConfigOverrides />
<Policies>
<ContainerHostPolicies CodePackageRef="Code">
<PortBinding ContainerPort="80" EndpointRef="Test1TypeEndpoint" />
</ContainerHostPolicies>
</Policies>
</ServiceManifestImport>
The CodePackageRef attribute must match the CodePackage Name of the ServiceManifest.xml:
<CodePackage Name="Code" Version="1.0.0">

ASP.NET Core deployment to IIS error: Development environment should not be enabled in deployed applications

I followed this article to deploy my ASP.NET MVC Core 1.0 app to local IIS on my Windows 10 that is using IIS 10. The application deployed successfully and it opens the home page fine. I'm using Individual User Accounts Authentication. On the home page when I enter login/password and click Login button, I get the following error. I'm using the latest versions of ASP.NET Core and VS2015. I used VS2015 Publish wizard to publish the app. Everything is done on the same machine:
An error occurred while processing your request.
Development Mode
Swapping to Development environment will display more detailed information about the error that occurred.
Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.
First, check the value of ASPNETCORE_ENVIRONMENT variable. You will have to set this environment variable to "Production" (or other environment than Development)
Otherwise, you can update web.config like this-
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Application.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>
Refer this post for more details.
I wanted to run it in development environment, so I added following in web.config file, and it worked for me:
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
If you are developing using ASP.NET CORE. You can find this setting inside properties and then in launchSetting.json file.
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
},
"nativeDebugging": false
},
"Ecommerce": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
Change "ASPNETCORE_ENVIRONMENT": "Development" to "ASPNETCORE_ENVIRONMENT": "Production"
You can find the launchSetting.json file by expanding properties
I had the same problem (ASP.NET CORE 3.1) but changing "ASPNETCORE_ENVIRONMENT" did not helped.
Scouring through the web I found that in Startup.cs, Configure method, this code was hiding the real issue.
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
Then I deleted the If block and added Database error pages ( You might need to Install Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore from NuGet )
app.UseDatabserrorPages();
So your Startup.cs will look like this
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
app.UseHttpsRedirection();
//Others will be Okay
Then you will see the real errors on the webpage. For me it was
Login failed for user IIS APPPOOL\DefaultAppPool
So I had to run a GRANT SCRIPT. I just had to run this script on my SQL Server
IF NOT EXISTS (SELECT name FROM sys.server_principals WHERE name = 'IIS APPPOOL\DefaultAppPool')
BEGIN
CREATE LOGIN [IIS APPPOOL\DefaultAppPool]
FROM WINDOWS WITH DEFAULT_DATABASE=[master],
DEFAULT_LANGUAGE=[us_english]
END
GO
CREATE USER [WebDatabaseUser]
FOR LOGIN [IIS APPPOOL\DefaultAppPool]
GO
EXEC sp_addrolemember 'db_owner', 'WebDatabaseUser'
GO
You can see this link : https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/deploying-to-iis
And my problem was solved. Hope this helps somebody.
There is a runtime exception in code. in Production mode it can not be show. so that it show "Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users"
in web.config file you will find
<aspNetCore processPath="dotnet" arguments=".\PortfolioApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
replace it with
<aspNetCore processPath=".\Application.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
now you run app in browser. It will show actual error message. Now it's time to fix the runtime exception.
I just replaced this:
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseMigrationsEndPoint();
}
else
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
with this:
app.UseDeveloperExceptionPage();
app.UseMigrationsEndPoint();
When your connection string is not correct, you get this error. When I correct my connection string it worked fine.
Eg: for correct azure db connection string
Server={Server Name};Initial Catalog={Database Name};Persist Security Info=False;User ID={DB User Name};Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
For me, it was a matter of adding the EnvironmentName property to the pubxml.
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/visual-studio-publish-profiles?view=aspnetcore-5.0
First, this error occurs where you publish a web site that raises errors in the run-time. So check your code again in the pages that give this error.
Then, set the value of ASPNETCORE_ENVIRONMENT variable to Production (instead of Development), you should also check the layout page and change <environment"development"> to <environment"Production">.
Finally, publish your web site.
This is tested in VS2017
This might not be the case for everyone, however I was trying to deploy a "release" configuration to a server that had an environment variable of "uat". I set up a uat configuration to use with my deployment and the message no longer appeared when navigating to my site url. Long story short, just make sure your intended build configuration matches the destination server as others have alluded to above!
The only way I could get rid of the Development Mode message was to change appsettings.json context from
Integrated Security=True
to specifying
User Id=username;Password=password and making sure the user was a db_owner.
By default, in production, you will see this error page unless you create/customize your own. Depending on the project type, it can be in different places like Pages/Error.razor or as a controller action.
This error message is just a hard-coded text in the Error.cshtml file, not the actual error message, only the RequestID is dynamically generated, but not helpful. It only comes up when you publish it to a production web server, and if there is an error.
The template wizard adds an Error.cshtml and Error.cshtml.cs files to the Pages folder if the project is a Razor Pages while it only adds an Error.cshtml to the Views\Shared folder if the project is MVC. This file was there since ASP.NET Core 2.0, still unchanged.
Code in the Error.cshtml file as follows (ASP.NET Core Razor Pages project):
#page
#model ErrorModel
#{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
#if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>#Model.RequestId</code>
</p>
<p>#Model.</p>
}
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed
information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
In the MVC project, the code is the same except first 2 lines, it has only one line, replacing ErrorModel with ErrorViewModel:
#model ErrorViewModel
If there is an error this file will show if the environment is NOT the DEVELOPMENT, while it will show the actual error message in the development environment, based on the code in the Configure method in Startup.cs file. The code below shows for Razor Pages, for MVC only change is the path to the Error file app.UseExceptionHandler("/Home/Error");:
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
}
else
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
We do not need to change the above code.
So this Development Mode message will come up for any error pops from the application. If you want to show the proper error messages, More information can be found here in the doc.
To avoid confusion, change the original message as shown above, <h3> header and <p> to:
<h3>This is Production Mode </h3>
<p>Contact the developers of the app. If you are the developer swap to the
Development environment to see detailed information about the error that occurred.
</p>
Now if we take a look at the line with <aspNetCore in the Web.config file in your server:
<aspNetCore processPath=".\OurASPNETCoreApplication.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
That indicates that this is in production mode by default since it doesn't include the child <environmentVariables> node. Now to change the environment to development change that line to:
<aspNetCore processPath=".\OurASPNETCoreApplication.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" >
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
and restart the web server. It will show the actual error message.
Most of the time it will be the database configuration errors.
Alternatively use a third-party logging provider, like Serilog to write logs into a text file.
This is an old thread. I didn't find the answer here.
But I found a solution and want to share it.
All worked perfectly on my computer. But when I publish to the web server and open the new page "MyLogin" I get the error. Solution that worked for me:
Delete the "bin" and "obj" folder in the current Project.
Remove all files/folders on the destination folder on the web server.
This is the default error page with generic error message.
I got this error after deploying the ASP.NET Core 3.1 MC published application on shared hosting. Default Home and Privacy pages were working as expected but when I tried to open a page that was fetching data from database the above error shown.
Error reason: In appsettings.json, I updated connection string Data Source=MyPC\MSSQLSERVER14 with Data Source=.\MSSQLSERVER2. I copied this data source ".\MSSQLSERVER2" from shared hosting connection string and pasted it in appsettings.json
Resolution: Changed data source ".\MSSQLSERVER2" to ".\\MSSQLSERVER2".
"ConnectionStrings": { "AppCon": "Data Source=.\\MSSQLSERVER2xxx;Initial Catalog=sqldb;Persist Security Info=True;User ID=sqluser;Password=********" }

authentication_ui_failed: The browser based authentication dialog failed to complete

Using below method query a token result in universal app:
AcquireTokenAsync(string resource, string clientId, Uri redirectUri, PromptBehavior promptBehavior);
No problem in F5 debug mode, but hit error when installed the app manually by a published store app package.
the error message:
authentication_ui_failed: The browser based authentication dialog failed to
complete. The system cannot locate the resource specified. (Exception
from HRESULT: 0x800C0005)
Please check the capabilities of your universal app. Following capabilities must be enabled for AAD browser authentication UI popup to be shown:
Enterprise Authentication
Internet(Client & Server)
Private Networks(Client & Server)
Shared User Certificates
If you want to enable them from the package.appxmanifest xml file of your app you should have following entries inside Capabilities tag as below which corresponds to above capabilities in the same order:
<uap:Capability Name="enterpriseAuthentication"/>
<Capability Name="internetClient" />
<Capability Name="privateNetworkClientServer" />
<uap:Capability Name="sharedUserCertificates" />
Hope this helps!
I got the same error message, although my problem was that I was using wrong redirectURI.
Need to use the one generated by:
redirectURI = Windows.Security.Authentication.Web.WebAuthenticationBroker.GetCurrentApplicationCallbackUri();

Resources