Redirect page when to try debug - asp.net-mvc

I assigned a project that is already been exists and can not reach it's developer.
My problem is when I hit the debug button on visual studio, project redirect itself to production URL.
I can see http://localhost:55291 url for a second but then redirects to https://test.customer.com url.
What I've been tried so far;
searched entire project (including app config files in .vs folder) for "https://test.customer.com", there is no result!
set a break point on a first line of Application_Start in Global.asax.cs, it's not hit the line!
looked for the prod url in database, no result!
Where should I look for next?
Workaround solution:
I changed the debug port and it worked!
And now I believe the problem is about to my computer but can not be sure.

Related

Random error in RDLC - Access to the path C:\Windows\TEMP

I am trying to generate a rdlc report and save it as pdf. It works perfectly fine on the localhost but after deploying it on the server after successfully generation of some files it stops randomly with below exception
System.UnauthorizedAccessException
Access to the path 'C:\Windows\TEMP\expression_host_791eafe958ba48999639e489485a25c1.dll' is denied.
I have tried giving full access to IUSR, IIS_IUSRS, IIS APPPOOL\MyPOOL, NetworkService and even disposing my localreport and setting permissions, example code below:
using (var lr = new LocalReport())
{
PermissionSet permissions = new PermissionSet(PermissionState.None);
permissions.AddPermission(new FileIOPermission(PermissionState.Unrestricted));
permissions.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
lr.SetBasePermissionsForSandboxAppDomain(permissions);
I even restarted the server, recycled app pool and also tried resetting IIS by aspnet_regiis -i
Nothing worked till now. Any help would be really appreciated.
This mostly an IIS issue.
Change the AppPool's Identity to LocalSystem, you shouldn't get the errors
I had the same scenario you described "It works perfectly fine on the localhost but after deploying it on the server...". What worked for me was:
1- check the new directory where the .rdlc file is located on the server. Get the full path
2- make sure the file and directory are the same in your code (and you're not pointing to the same old location, localhost)

A Renamed WebSite, Web.Config, Log4Net, using IIS Express, using Git version control, in VS2015, failing

So this was quite a hilarious error and was quite difficult to trace, so I'm going to chuck everything on here in case it happens to anyone else;
While working on a website in production, its name changed. I noticed that the IISExpress instance displayed not only the new name, but a '\' and the old name as three separate instances.
As I was attempting to add log4net to the project, I attempted to use this line in the web.config:
<log4net configSource="log4net.config" />
Which caused the following error on app run:
the configSource file '[file]' is also used in a parent, this is not allowed.
the configSource file is also used in a parent, this is not allowed.
This was perplexing as I had not used this source anywhere else, and no matter what file I changed it to, I got the same error.
log4Net worked fine when I defined it entirely within my web.config, but that's not what I wanted, so I investigated further. Interestingly, a colleague who'd just been brought onto the project could run the app fine with the separated config, but I and another dev who'd been working on this project for a while could not.
How can I and another colleague with exactly the same setup have a failing app with the same config as someone with a fresh checkout have it work fine?
The web.config file is "composed" when it is read by the application by scanning the file system from the current directory up to the drive root and by looking in a number of pre-defined places (such as the location of the Machine.Config and the default ASP.NET config.) If you're using Virtual Directories on the same website in IIS, things can turn even more interesting.
Any of these files can define configuration sections and can possibly externalize the configuration, and thus cause the error message you're seeing.
The following doc on MSDN outlines exactly how the configuration is being parsed and composed:
https://msdn.microsoft.com/en-us/library/ms178685.aspx
It turned out to be that IISExpress had saved the previous settings in a .vs folder at solution's root level, and all three of those instances were using the same config, and looking for the same file, hence the error.
The solution was as follows:
In the web-app's project, reset the web properties to look at the root site (\ instead of \newname\)
Trash the entire .vs directory
Restart Visual Studio and Reload the project.
For different versions of VS, the .vs folder is in different locations on your machine.

Change in web config results in "Could not find assembly..." error

I've come across an unbelievably stupid situation with my ASP.NET MVC application hosted in IIS 7.5. Here's the case:
I publish the application to the server and test it. It works just fine
I change anything in the web.config file and then undo the change. So it's in its original state
I test the application again but this time I get
Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Data.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. error.
Please note this: I just open the web.config file and edit and then immediately undo that edit. It doesn't matter in which line of which section I make edit. (After all, aren't configuration files there to not have to touch the code?)
Now comes more interesting part.
I copy and paste the latest published files to the application folder
test the application: Still get the same error
I republish the application and copy/paste to the folder, EXCEPT FOR THE WEB.CONFIG FILE. So I don't even touch the "damaged" config file.
Test it, voila, it works.
I just don't get it. Do you have any clue about this issue?
The problem was caused by a third party tool called EntityFramework Profiler with which I traced SQL commands issued by Entity Framework. After removing it from the application, the problem disappeared.

server error in '/' application. resource not found (when modified)

I have a MVC application which is currently checked in through TFS. When i try to run the website, it is working well. However, whenever i do some code changes on the main page which is an .cshtml file, it showing an error "Server Error in "/" application. Resource not found."
I've tried to clean the solution then build again but i am still encountering that error.
I tried to undo pending changes on that .cshtml file. Then it is running well again.
Am I missing something in here? Thanks in advance!
try this:
clean solution and rebuild solution
restart visual studio
get specific version with latest and overwrite everything (be sure nothing is checked out)

How can step through an Action that is requested from JavaScript during execution?

There is this one action that is requested using javascript during the loading of a page, it takes over 25 seconds to resolve. Looking at the code makes me think there is a scaling issue, but I am wondering if there is any way I can step through the code during the request so I can see what is happening. I try clicking 'debug/start debugging' but it won't launch the proper URL (access to the site is subdomain based), and it will also not find certain dependencies. I am able to browse the site directly via URL locally after mapping a URL via my hosts file to localhost (127...) but the default url that pops up (localhost...) from debug does not work because it is not formatted properly.
Any ideas?
You can attach the debugger to your browser by selecting "Attach to process" under "Debug" menu.
In the past, at least with ASP.NET we have used tracing to debug issues. You will just need to enable it in the webconfig. If you use warn, the messages will show in red and be easier to spot.

Resources