IIS.NET
29 TopicsASP.Net Core 6 Web App - Fails to connect to database after published to on-prem IIS
Dear Community, I started to learn .Net core and entity framework, and its great. I built a small webapp as a test with a database (SQL LocalDB) and locally on my dev machine, it works fine. I publish to a folder location, then copy locally to a Windows 2019 Server and added a website on the server's IIS. The app will run the razor pages without a model, but the page that serves the model to add data or view data from the SQL database fails and the error is weird and it says there is no server found and cannot authenticate NT Authority\System. I made sure that SQL server express is installed and I can connect, I made sure localDB was added as a feature to the sqlexpress instance, etc., etc., My question is, do I have to do anything funky like wear a foil paper hat, to get this to work? I cant seem to find any documentation at all and youtube tutorials go through all the motions except publishing the app. Any help will be greatly appreciated.6.1KViews1like5CommentsSession values lost on switching server with statesession in asp.net webform with webfarm blue/green
Hi, I have an asp.net webform website implementing blue/green architecture to get smooth deployment. The blue/green is a webfarm using ARR in IIS 10 and the website use ASP.NET State Service. The site blue and green are on the same server (same IIS) as the ASP.NET State Service. The web.config contains the correct configuration to get the webfarm work correctly <sessionState mode="StateServer" stateConnectionString="tcpip=loopback:42424" cookieless="false" timeout="20"/> MachineKey and validationkey identical When we swap the blue/green website, the user can smoothly continue his navigation on the website (same sessionid used by the user on both website each time we swap). However, the values in the session do not follow up. They seem to be compartmentalised by each website. I finally found a possible explanation stating that in a webfarm, the website should have the same ID so the session values follow. https://serverfault.com/questions/288981/load-balanced-iis-7-5-web-server-asp-net-session-state-problem My problem is that I can't have the 2 websites having the same ID because they are in the same IIS (same server). Is there any workaround or setting I can change to correct that behaviour? Thank you,1.6KViews0likes5CommentsVS 2022 + .NET Core 3.1 Web app can't debug under IIS profile
I receive the following error when trying to debug the .net core web app under the IIS profile. launchSettings.json is as follows and the PC IP is correct. (192.168.31.107) "cqrs" site is also created in IIS and with a separate app pool (CLR version: No managed code) The URL (http://192.168.31.107/cqrs/swagger/index.html) also works when typed into the browser. The only issue is when hit F5 from VS 2022 I get the popup error and can't debug. Hope this info is enough for you to let me know how to fix this. Please don't hesitate to ask for more info, I'll be happy to provide it. If I change the application URL to "http://localhost/cqrs" then the VS2022 lets me hit F5 and debug. But I want the web app to run with the IP, not with localhost. I found a https://stackoverflow.com/questions/62385404/visual-studio-2019-not-found-local-iis-web-site and tried everything. Nothing works. Thanks again.1.5KViews0likes3CommentsAccess Denied
Hi Guys, After our system admin processed some updates in the server now I'm getting this error when loading my application: CS0016: Could not write to output file 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\cvdesktoptest\bd400d26\e617c1c3\App_Code.v7si8vgx.dll' -- 'Access is denied. any help pls? Thanks1.3KViews0likes1CommentIIS Static Compression caching truncated files
OS: Windows Server 2016 IIS: 10.0.14393.0 We serve a 1.5MB CSS file from our main website. With static compression enabled, it delivers a ~220kb file to the client from the IIS compression cache. However, we've now had several instances where the cached version of the file is truncated. Since it is the main CSS for the page, the layout is distorted, and the site becomes unusable. I was able to partially reproduce the issue by forcing a slow upload over FTP. Since the FTP server doesn't lock the file during upload, IIS serves a partial file if it reaches the cache threshold (the default 2 loads in 10 seconds in our case), during the copy. This is expected - IIS doesn't know the file upload is in progress, and it isn't locked, so it serves the partial file. However, it seems that periodically, IIS doesn't notice that the cached version differs from the source file, and it continues to serve the truncated file from the compression cache after the file is fully uploaded. I haven't been able to reproduce the conditions that cause this specifically - during testing, IIS detects the difference and re-caches the compressed version of the full file. But a partial file has been left in the cache multiple times on our production servers within the last 2-3 months. For now, we're fixing this my automating deletion of the cached copy when it is detected as being too small, but we'd be interested in a more permanent fix. Our process has not changed recently - no new software installed on the web servers other than Windows updates. Has anyone else encountered this?1.3KViews0likes2CommentsLoads of huge ASPNETCORE*.tmp files created
Hello, I have an ASP.NET 3.1 Razor site that's been running just fine for a year or two. Today, the server admin told me that he had to reboot the server because it had become unresponsive and he noticed a load of large ASPNETCORE*.tmp files (all around 2GB) in a temp folder. He worked out which site it was, and killed the IIS process, at which point the server became responsive again and the files disappeared. However, it quickly started writing them out again. As far as I can see from searching around, these temporary files are when a large request comes in, and IIS writes them out, deleting them again when the request is done. However, this puzzles me, as the site is pretty simple, and doesn't make large requests. There's nothing in the code that could do that (as far as I can see). Something else that puzzles me is that he pulled the following out of IIS... Two things spring to mind... 1) I don't have a handler named Matches in the Product.cshtml.cs file, so I don't know why IIS doesn't just send back a 404. If I run the site in Visual Studio and enter that URL, I get the 404 page. 2) Assuming that the last column is milliseconds, then it means that these requests are taking around 35 minutes to execute! That would explain why the files hang around for so long and cause problems, but I really have no idea why a request could take that long. That's all on top of the question as to why the requests are so large. Unfortunately, we can't access any of these temp files to see what's in them, as IIS has them open. Anyone able to advise how we diagnose this issue? It's currently killing the server, and causing awful performance on a busy site. Thanks for any help you can give. If there's any more information I can give, please let me know.1.2KViews0likes0CommentsWeb.config connection string encryption and deployment
Hi everyone, I just want to get confirmation on two basic matters: - Connection string encryption in the web.config and - Deployment configuration to deploy a web application when the web.config needs to be encrypted Questions: 1. For Asp.Net applications, is still using the aspnet_regiis method, the best one to encrypt your connection strings in the web.config? 2. What about asp.net core? is it the same or may it differ? 3. When deploying this asp.net web application to IIS using DevOps pipelines, what is the suggested method? should we just add the encrypted connection string as a deployment variable that we replace depending on the environment? (there would be one value for TEST, UAT and PROD, all different). Thanks!1.1KViews0likes1CommentBlazor Web App runs perfectly locally but not when uploaded to a live server.
I've created a Blazor Web App that allows a user to select from folder a text file. They then click a submit button that sends the text file to the chat gpt API, which, after about 30 seconds or so, sends a reply back that the user can then copy it via a button. This all works correctly when I run it locally on my computer. When I upload it to the server that hosts my site and run it from the live site, I can select one of the text files, but it no longer sends it to the API to be processed. According to the servers support, everything is fine on their end so its my code. I'm very new to this and for the life of me, I cannot find why it doesn't work on the live server when it works locally. Any suggestions would be greatly appeciated.1.1KViews0likes0CommentsWeb sites deployed on IIS will become inaccessible after running for a period of time
I deployed some websites on IIS. After a period of time. None of these websites can be accessed normally. need to visit these websites once on the IIS server before you can continue to visit them normally. I want to know why?1.1KViews0likes5CommentsAntiForgeryToken Decrypt exception in a ASP.Net MVC App on a single Azure VM
Hi all, I have an issue on two Azure Windows 2019 VMs running IIS that AntiForgeryToken validation does not work quite often. These run the prodcution environment, it does not happen on my master and dev envs, both of them being physical machines within my network. I evaluated the issue and as there is no cluster involved, so the static machine key solution, which I also tried does not help. Application pool recycling as of timeouts between GET and POST also does not seem to be the issue, as this even occurs if there are only 5 seconds between GET and POST. Interesting fact is that sometimes it does work with Chrome for some users, when it doesnt work in Edge or Firefox. I can reproduce that issue from my work network to one VM, whereas it works from my home network at the same time. So might be a firewall issue of some kind. We do have a sonicwall at work, but a trace di1.1KViews0likes0Comments