Breeze metadata returns 504 error - asp.net-web-api

I've run into an issue with Breeze such that when I try to call the Metadata action on my controllers, they fail with a 504 error.
The approximate call is
//servername/breeze/controller/metadata
Environment
Web Api running via IIS7 on load balanced Win 2k8 Azure Virtual Machines
Versions (installed via NuGet)
Breeze Client 1.4.2
Breeze Client and Server 1.4.2
Breeze Server - for ASP.NET Web Api (Core) 1.4.2
Breeze Server - for ASP.NET Web Api and Entity Framework 1.4.2
Update: Upgrading to Breeze 1.4.5 makes no difference
Previously it worked fine and the only recent change is the introduction of load balancing.
Of note, I also have multiple controllers, each with their own metadata.
Cases where it runs sucessfully
Running via localhost.
Removing the [BreezeController] attribute from my controller
Renaming the metadata function
Cases where it fails
When deployed
When running a simple test to return a string, eg:
[HttpGet]
public string Metadata()
{
return "This was a test";
}
For some reason Breeze does not seem to like the Metadata function in my controller.
Updates:
It doesn't look like its specifically related to using a load balanced endpoint as I tried setting it up running directly on port 8080 with a non load balanced endpoint and had the same issue.
IIS failed request tracing doesn't seem to log anything for the failed request, though the request does appear in the IIS logs.

I had the same problem after updating from 0.72 to 1.41 and changing the route from api/{controller}/{action} to breeze/{controller}/{action}. I did not get an answer from the breeze folks so I withdrew the question.
However, I now think the problem was permissions. Localhost:50033 in VS ran as me and I have a SQL Server account, so I though it would be cool. After deployment to my local IIS and to a test server IIS, I was getting a 500 error.
I finally got way into the jquery code and determined from the jqXHR, that the error was SQL not handling the credentials for the anonymous user; a Doh! moment if there ever was one. I changed my connection string in web.config and that did it.
<!--<add name="PilotPlant" connectionString="Data Source=dataweb;Database=PilotPlant;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />-->
<add name="PilotPlant" connectionString="Data Source=dataweb;Database=PilotPlant;Trusted_Connection=no;User Id=sa;Password=sapassword" providerName="System.Data.SqlClient"/>
This is less secure, but I am running inside the firewall, so it is not a problem for me.
So my answer is check your permissions on the cluster. I hope this helps.

Related

GoLang SPA returning 500 Internal Server Error on Refresh only

I have a golang API app that is currently serving double-duty as a Single Page App server with static content using the method shown here: https://hackandsla.sh/posts/2021-11-06-serve-spa-from-go/
Everything is working great in terms of navigation until users try to refresh URIs with encoded JSON in them. For example:
/licenses
will refresh file and draw the page as it would normally have appeared through internal history.push()
/licenses/show/%7B"options":%7B"container":"home","field":"date","order":"desc"%7D,"license":"00001a"%7D
will cause the 500 error.
I did the initial development with IIS as a web server so these Refresh errors never happened in that environment. And when the server is ready to be deployed I plan to use Caddy and reverse proxy the API and am assuming it will handle the Refreshes with the same aplomb as IIS.
But for now I am hoping to run tests against my simple server so I'd like to solve this issue out of curiosity in addition to development expediency.
Bottom line: What cause golang http.ListenAndServe to return 500 errors?
UPDATE:
As I need to be able to test and hand off for others I have converted to a querystring which http.ListenAndServe is happy with:
/licenses/show/%7B"options":%7B"container":"home","field":"date","order":"desc"%7D,"license":"00001a"%7D
causes 500 error
/licenses/show?state=%7B"options":%7B"container":"home","field":"date","order":"desc"%7D,"license":"00001a"%7D
works fine

ASP.NET Core 3.1 Web API HTTP error 500 in production

I have an ASP.NET Core 3.1 Web API and it has worked so far. I had to modify the CORS setting in Start.cs and after that it gives HTTP 500 error in production IIS.
It works correctly when I run it in the Visual Studio even though if I run it on the server with double clicks.
Unfortunattelly IIS log doesn't contain any information about error.
I have no idea why this error occurs.
I over copied web.config and I forgot to overwrite modules="AspNetCoreModuleV2" to modules="AspNetCoreModule".
Sorry.

WCF not working when debugging in visual studio but works in IE

I have a WCF that is hosted in an ASP.NET application. Suddenly, the WCF service has stopped working when i debug it in visual studio 2010. When i try to access the service, it throws the below exception.
CommunicationException was unhandled by user code. The remote server returned an error: NotFound
I have WCF tracing enabled but no errors are being logged.
The strange bit is that if i deploy the code to my QA server and access the application, the service works fine, so the code looks like not the problem.
If i also get the source code currently running in production successfully & try debugging it in my dev environment, it fails with the same error i mention above.
Any one have an idea what could be messed up in my dev environment?. I have tried both IE, Firefox & Chrome & the results are the same.
I after a very long debugging involving deleting Bin & obj folders and lots of rebuilds, i finally got this WCF service working again.
First, i suspected the service could be corrupted somehow, so i tried to update the service reference in my silverlight application but was bumped with the following error.
There was an error downloading 'http://localhost/mySite/Webservice/GetData.svc'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://localhost/mySite/Webservice/GetData.svc'.
The remote server returned an unexpected response: (405) Method Not Allowed.
The remote server returned an error: (405) Method Not Allowed.
I then browsed to the physical folder path to confirm if really my .svc file was there and indeed as expected, the file was there.
Trying to Browse to the path http://localhost/mySite/Webservice/GetData.svc in my browser bumped me with another error below.
HTTP Error 404.7 - Not Found The request filtering module is
configured to deny the file extension.
Most likely causes: Request filtering is configured for the Web server
and the file extension for this request is explicitly denied.
This made me start thinking that suddenly, IIS 7.0 has decided to block access to my .svc files.
I then added fileExtension=".svc" mimeType="application/octet-stream" to IIS, restart IIS but got the same error.
I then read on some blog i cant remember about adding <add fileExtension=".svc" allowed="true" /> under <requestFiltering> tag in file applicationHost.config located at C:\Windows\System32\inetsrv\Config, still nothing changed. Tried adding <mimeMap fileExtension=".svc" mimeType="application/octet-stream" /> under serverSideInclude in the same file, again with no luck.
Tried this http://www.adamwlewis.com/articles/iis-7-not-serving-files-4047-error still with no luck.
The following 2 steps are i think what resolved the issue.
I added a mapping for the SVC extension to ASP.NET by running ServiceModelReg.exe -i from C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation
Browsed to my .svc file in the browser and this time it looked like i had made some progress but still, i had one more error to overcome . The is bellow.
Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
I resolved the above error by registering the correct version of ASP.NET using the ASP.NET IIS Registration Tool (aspnet_regiis.exe,) as described in the link below
https://msdn.microsoft.com/en-us/library/hh169179(v=nav.70).aspx
At this point my service was back to normal as it had always been. I still haven't figured out what messed up my development machine.

DotNetOpenAuth provider don't work in ie11 on https

The site of our Openid provider revealed a problem with ie 11.
After login, when the provider is required to make the return redirect page is reloaded and again we find ourselves on the page, login and password.
After several attempts to get this error.
The lines on which the error occurs:
if (ProviderEndpoint.PendingAuthenticationRequest.IsDirectedIdentity) {
ProviderEndpoint.PendingAuthenticationRequest.LocalIdentifier = Code.Util.BuildIdentityUrl();
}
What is interesting, this problem occurs only when using https. When http everything is OK.
This issue is a result of the IE11 new User Agent String.
MS is already have a patch for .Net Framework 4, but it didn't work for me because I have .Net Framework 4.5 on the server while provider is using .Net Framework 4.0.
So I can't install the patch properly (link).
I temporarily solved this issue by using the value of UseCookies for the cookieless attribute in web.config file (<authentication><forms> section)
I can confirm this is also the solution for a custom MembershipProvider we use, which is derived from System.Web.Security.MembershipProvider.

Session and Cookies not working on Windows Azure Cloud environment

I have migrated a website to cloud, which works perfectly on my local machine using the Compute and Storage Emulators.
However, when I put it onto Windows Azure Cloud, the session and cookies are not working fine. Part of web.config file is given below.
<sessionState timeout="30"
mode="SQLServer"
sqlConnectionString="Server=sxxxxxxxxx.database.windows.net;User ID=xxxxx#sxxxxxxxxx;Password=MY_PASSWORD"
cookieless="false"
allowCustomSqlDatabase="true" >
</sessionState>
Can anyone please guide be in correcting the same ? All the other things in the website are pretty much working fine.
Below is some additional information:
To summarize, I have done the following.
Migrated a website to Windows Azure successfully
Created the required connection strings for the database access successfully.
Tested the website on the local machine using Compute Emulator and Storage Emulator.
When I published the website and uploaded the packageFile and configurationFile, everything was working fine in general. BUT
for the pages which used session/cookies. All static pages worked well. All database access were proper.
Then, I wrote some code for setting right the session.
GOT ERRORS AND ENTIRE WEBSITE STOPPED WORKING
Created the database and tables that were required (ASPSTATE database and its corresponding tables). Everything went well.
http://blogs.msdn.com/b/sqlazure/archive/2010/08/04/10046103.aspx
Tested the website ... Still getting the error on local and on cloud...as mentioned previously in this post.
Can you please guide me to rectify this.
.Hey guys,
Thanks for the replies. I modified the session state in web.config a little and its as below
<sessionState cookieless="false" mode="SQLServer"
sqlConnectionString="data source=serverName.database.windows.net;user id=UserID#serverName;password=password;Trusted_Connection=False;Encrypt=True;"
timeout="20"
allowCustomSqlDatabase="true">
</sessionState>
Now its working fine.
Regards
Sandeep
I assume that the SQL Server Session State Provider isn't throwing an exception, just not keeping state?
You'll be aware that a cookie is used to hold the session ID, so it may stem from a general cookie problem.
Are you doing anything unusual with domain names? I'm just wondering if there's a domain mismatch between the cookies and the URL through which you're accessing the site, meaning that the cookies don't get presented on subsequent requests.
Of course, it's also possible that a security limitation is preventing your browser accepting the cookies, but you'd likely have noticed that as an issue before now!

Resources