nuget package restore fails for webapp with custom nuget.config - azure

I am attempting to fix a problem I have with restoring nuget packages for a .net core 2.0 webapi that has a custom package source.
Basically when including the nuget.config any microsoft packages fail to install because it seems to ignore my nuget reference.
I have found a workaround, that is to remove my custom nuget.config, let the build fail, once it fails it will have downloaded the proper things from nuget.org and then by adding the custom file back in, it will restore those microsoft packages from disk and then reachout to get my custom nuget package.
My nuget Package config looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="ASPNET Team" value="https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json" />
<add key="OTL" value="https://www.myget.org/F/{redacted}/api/v3/index.json" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
<packageManagement>
<add key="format" value="0" />
<add key="disabled" value="False" />
</packageManagement>
<disabledPackageSources />
</configuration>
The Errors from Kudu are:
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://www.myget.org/F/{redacted}/api/v3/flatcontainer/microsoft.extensions.caching.sqlserver/index.json'.
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://dotnetmyget.blob.core.windows.net/artifacts/aspnetcore-ci-dev/nuget/v3/flatcontainer/microsoft.extensions.hosting.abstractions/index.json'.
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://dotnetmyget.blob.core.windows.net/artifacts/aspnetcore-ci-dev/nuget/v3/flatcontainer/microsoft.extensions.caching.sqlserver/index.json'.
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://dotnetmyget.blob.core.windows.net/artifacts/aspnetcore-ci-dev/nuget/v3/flatcontainer/microsoft.entityframeworkcore.tools/index.json'.
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://www.myget.org/F/{redacted}/api/v3/flatcontainer/microsoft.extensions.dependencyinjection.abstractions/index.json'.
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://dotnetmyget.blob.core.windows.net/artifacts/aspnetcore-ci-dev/nuget/v3/flatcontainer/microsoft.extensions.dependencyinjection.abstractions/index.json'.
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://www.myget.org/F/{redacted}/api/v3/flatcontainer/microsoft.extensions.caching.sqlserver/index.json'.
Doing a dotnet restore directly from Kudu console yields the same results. I have pulled the NuGet.config from my development machine which i know successfully restores both microsoft packages and custom packages and attempted to use that and it still failed.
I'm beginning to think its an outbound port blocking firewall thing within azure but some googling of outbound firewall or proxy on webapp was not fruitful.

So after researching and dealing with the Kudu team and Nuget team we found that Azure WebApps has a limited amount of threads in basic and free tiers and when nuget restores happen it does so in a parallel asynchronous way and it hits the thread limit and fails.
To fix, you have to deploy a custom deployment script with --disable-parallel on the dotnet restore.

Related

Hosting Asp.NET Core on IIS + Kestrel: randomly slow response

I'm facing a problem with IIS + Kestrel hosting of asp.net core application (web api).
Sometimes response delay is about 5sec. In such case Chrome shows "GET net::ERR_CONNECTION_TIMED_OUT" (but Firefox waits until response)
It only happens on IIS, if I run it locally within Visual Studio Code it works fine (at least I haven't caught any "freezes").
There is some info from app log on server side. For successful request it looks like:
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 OPTIONS http://
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 0.2813ms 204
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://
info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerMiddleware[2]
Successfully validated the token.
info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerMiddleware[3]
HttpContext.User merged via AutomaticAuthentication from authenticationScheme: Bearer.
info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1]
Authorization was successful for user: admin.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method <method-name> with arguments <args> - ModelState is Valid
info: Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor[1]
Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Executed action <method-name> in 41.9809ms
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 42.6694ms 200 application/json; charset=utf-8
for failed looks like:
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 OPTIONS http://
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 0.3408ms 204
Application pool for that app is set up without managed code.
Web.config contains:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\app.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="app-release" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>
What may be a cause of such strange behaviour?
P.S.
IIS version - 10
netcoreapp - 1.1 (common "Microsoft.AspNetCore."
libraries - 1.1.1)
Update:
I set "Trace" level for logging and didn't see any logs about "corrupted" request, only about requests before. Also took a look at chrome dev's tools "network" tab and there is:
Request Headers
Provisional headers are shown
Access-Control-Request-Headers:access-control-allow-origin,authorization
Access-Control-Request-Method:GET
Update:
I have no idea why but it's started to spontaneously error even on static content like css.
Also I forget to note that I have the same functionality on asp.net web api 2 (not core) - and it works fine on the same server.
Founded such info in log before slow request:
dbug: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HL3SC4O1J78T" stopped.
dbug: Microsoft.AspNetCore.Server.Kestrel[8]
Connection id "0HL3SC4O1J78S" sent FIN with status "0".
dbug: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HL3SC4O1J78S" stopped.
dbug: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HL3SC4O1J78R" stopped.
dbug: Microsoft.AspNetCore.Server.Kestrel[8]
Connection id "0HL3SC4O1J78V" sent FIN with status "0".
dbug: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HL3SC4O1J78V" stopped.
Update:
There is no any messages in IIS log (within inetpub/logs) about "corrupted" request too. Just an information about last successful request-response. It looks like request isn't handled by IIS at all. Is it possible (I'm not experienced in IIS setup and configuraiton)?
Also tried to use a stub - empty .net core application instead of my. The result is the same. From what I'm concluding that the problem isn't in my app

Error while setting up local cluster with service fabric SDK version 2.1.150.X

While creating local cluster with latest service fabric SDK, I got following errors with Visual Studio 2013 Update 5 while it works fine with Visual Studio 2015 Update 3:
Cluster manifest validation failed with exception System.ArgumentException: Error occurs in section Federation, parameter System.
Fabric.Management.ServiceModel.SettingsOverridesTypeSectionParameter...
OR
Cluster manifest validation failed with exception System.ArgumentException: Section FaultAnalysisService found in cluster manifest but not Configurations.csv in system.fabric.management.dll
What I did to fix it?
If you closely look into error, you will find that following two files settings are not compatible.
C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code\Configurations.csv
and
C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup\NonSecure\ClusterManifestTemplate.xml
Just disable following in ClusterManifestTemplate.xml:
<Section Name="Federation">
<Parameter Name="NodeIdGeneratorVersion" Value="V3" />
<!-- <Parameter Name="UnresponsiveDuration" Value="0" /> -->
</Section>
and
<!-- <Section Name="FaultAnalysisService">
<Parameter Name="TargetReplicaSetSize" Value="5" />
<Parameter Name="MinReplicaSetSize" Value="3" />
</Section> -->

Error events 50000780 in Event Log on Azure, what do they mean?

In my Azure Web Site's Event Log I see same error every 1-5 minutes:
1 [varies]
5
50000780
What does this error message mean? Thank you in advance!
I found a similar issue, albeit for Sharepoint and Lightswitch. It looks like they had a similar error number show up in their event logs, breaking it down into the XML output:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="IIS Express" />
<EventID Qualifiers="32768">2284</EventID> <!-- Searched on this -->
<Level>3</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2013-09-14T03:48:18.000000000Z" />
<EventRecordID>8608</EventRecordID>
<Channel>Application</Channel>
<Computer>PSN-W12S-720</Computer>
<Security />
</System>
<EventData>
<Data>1</Data>
<Data>5</Data>
<Binary>50000780</Binary>
</EventData>
</Event>
Then I did a search on the EventID from above and found that there is an TechNet Article about Event ID 2284 which essentially states that FREB wasn't able to write to the logs.
FailedRequestTracing module failed to write buffered events to log
file for the request that matched failure definition. No logs will be
generated until this condition is corrected. The problem happened at
least %1 times in the last %2 minutes. The data is the error.
Do you happen to have Failed Request Tracing enabled for your site? If not you might want to, apparently it's trying to write something every 1-5 minutes.

WSO2 API Manager 1.6.0 - API Authentication Failure

-Updated with pics of request header and params.
Can anyone tell me why WSo2 API Manager does not authenticate?
I have set up two WSo2 API Manager 1.6.0 instances. One that is distributed and a stand alone instance. I also have created a version of the CDYNE sample API that requires authorization and another version that does not. It does not appear that the API is published correctly because it does not matter what level I set the api security to when creating the api.
Here is the api on the gateway:
<?xml version="1.0" encoding="UTF-8"?><api xmlns="http://ws.apache.org/ns/synapse" name="Creator1--APIPhoneVerify" context="/APIPhoneVerify" version="2.0.0" version-type="url">
<resource methods="POST GET OPTIONS DELETE PUT" url-mapping="/CheckPhoneNumber">
<inSequence>
<property name="POST_TO_URI" value="true" scope="axis2"/>
<filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
<then>
<send>
<endpoint name="Creator1--APIPhoneVerify_APIproductionEndpoint_0">
<http uri-template="http://ws.cdyne.com/phoneverify/phoneverify.asmx">
<timeout>
<duration>30000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<initialDuration>0</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<errorCodes>-1</errorCodes>
</markForSuspension>
</http>
</endpoint>
</send>
</then>
<else>
<send>
<endpoint name="Creator1--APIPhoneVerify_APIsandboxEndpoint_0">
<http uri-template="http://ws.cdyne.com/phoneverify/phoneverify.asmx">
<timeout>
<duration>30000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<initialDuration>0</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<errorCodes>-1</errorCodes>
</markForSuspension>
</http>
</endpoint>
</send>
</else>
</filter>
</inSequence>
<outSequence>
<send/>
</outSequence>
</resource>
<handlers>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler"/>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.throttling.APIThrottleHandler">
<property name="id" value="A"/>
<property name="policyKey" value="gov:/apimgt/applicationdata/tiers.xml"/>
</handler>
<handler class="org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageHandler"/>
<handler class="org.wso2.carbon.apimgt.usage.publisher.APIMgtGoogleAnalyticsTrackingHandler"/>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler"/>
</handlers>
</api>
When I use the 'try it' feature it appears that the key is not passed and I get an error.
Here is the key:
Here is the response:
Here is the wso2carbon.log:
TID: [0] [AM] [2014-02-05 14:25:02,513] ERROR {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler} - API authentication failure {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler}
org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException: Access failure for API: /APIPhoneVerify, version: 2.0.0 with key: null
at org.wso2.carbon.apimgt.gateway.handlers.security.oauth.OAuthAuthenticator.authenticate(OAuthAuthenticator.java:139)
at org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler.handleRequest(APIAuthenticationHandler.java:92)
at org.apache.synapse.rest.API.process(API.java:285)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:63)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:336)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:168)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
TID: [0] [AM] [2014-02-05 14:25:02,516] INFO {org.wso2.carbon.bam.message.tracer.handler.util.HandlerUtils} - Massage Info: Transaction id=115815524651347724395990 Message direction=OUT Server name=7.40.2.26:9765 Timestamp=1391631902516 Service name=__SynapseService Operation Name=mediate {org.wso2.carbon.bam.message.tracer.handler.util.HandlerUtils}
I then tried from an external source in case it was a 'tryit' problem. In this case the key was at least passed.
Here is the request and reply:
Here is the wso2carbon.log:
TID: [0] [AM] [2014-02-05 14:26:24,053] ERROR {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler} - API authentication failure {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler}
org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException: Access failure for API: /APIPhoneVerify, version: 2.0.0 with key: CgtcOiDinAKo4hKbtDV_fr6JIVAa
at org.wso2.carbon.apimgt.gateway.handlers.security.oauth.OAuthAuthenticator.authenticate(OAuthAuthenticator.java:139)
at org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler.handleRequest(APIAuthenticationHandler.java:92)
at org.apache.synapse.rest.API.process(API.java:285)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:63)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:336)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:168)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
TID: [0] [AM] [2014-02-05 14:26:24,056] INFO {org.wso2.carbon.bam.message.tracer.handler.util.HandlerUtils} - Massage Info: Transaction id=115823714657361932967093 Message direction=OUT Server name=7.40.2.26:9765 Timestamp=1391631984056 Service name=__SynapseService Operation Name=mediate {org.wso2.carbon.bam.message.tracer.handler.util.HandlerUtils}
Can you please try this API
http://api.openweathermap.org/data/2.5/weather
with parameter q=London
The final request should look like the following
http://localhost:8280/yourAPI/1.0?q=London
I have added 2 versions of the same api. 1.6.0 (which doesn't work) and 1.6.1 (which does work).
The error message regarding API authenication failure led me to believe it was a auth problem.
However, since your worked with the /* url pattern I tried that, instead of a pattern of /CheckPhoneNumber and it worked. I guess having a url pattern of /CheckPhoneNumber and updating the swagger doc to have the definition include /CheckPhoneNumber are NOT the same thing.

Unhealthy WorkerRole on Windows Azure

I have terrible problem with WorkerRole instance on Windows Azure. I have a Windows Azure projct that contains WebRole and WorkerRole.
The problem is, the WorkerRole instance is Unhealthy. The Error on a server:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Level>2</Level>
<Task>100</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2013-02-18T21:29:18.000Z" />
<EventRecordID>864</EventRecordID>
<Channel>Application</Channel>
<Computer>RD00155D3A4A2E</Computer>
<Security />
</System>
<EventData>
<Data>WaHostBootstrapper.exe</Data>
<Data>6.0.6002.18488</Data>
<Data>505cf7da</Data>
<Data>ntdll.dll</Data>
<Data>6.0.6002.18520</Data>
<Data>4e811810</Data>
<Data>c0000374</Data>
<Data>00000000000acb47</Data>
<Data>ae8</Data>
<Data>01ce0e1ef01200d9</Data>
</EventData>
</Event>
Faulting application WaHostBootstrapper.exe
Can somebody help me ?
p.s Project works perfect on local machine.
If it works on your machine but failed on the cloud it might because you miss some assemblies or dependency component.
You can enable the IntelliTrace when deploying so that later you can download the debug file and this might includes the actual exception/error for your worker role. http://msdn.microsoft.com/en-us/library/windowsazure/ff683671.aspx

Resources