Using Workspace.PendAdd in IIS doesn't work - tfs

I'm trying the WorkSpace.PendAdd method under Microsoft.Teamfoundation.Client namespace to add the local folder to TFS, it works normally when i debug with VS2010, but it doesn't work if it's published to IIS. I also tried giving the full control to the folder, but still no effect. Any idea will be appreciated.

Check to see what identity the web app is running under. Does that ID have appropriate rights in TFS? If you're hosting on a web server that is not also your TFS application tier, you could also be running into the two-hop limitation of passing identity.
When you're running in debug mode, it is probably picking up your credentials, and since your machine counts as hop zero, there's no problem passing them on to the TFS application tier.

I found a solution after checking the versionControl NonFatalError event.
Before the calling to workspace.PendAdd, just call:
Workstation.Current.EnsureUpdateWorkspaceInfoCache(
_versionControl,
_versionControl.AuthenticatedUser);
(for some reason it's the only way the specific file folder path will be mapped when running in IIS)

Related

Unable to start debugging on the web server. The debugger cannot connect to the remote computer in MVC

I've just started to work on a MVC project. It's a web portal. I've set my sites on my local IIS 6.0
But when I want to start debugging, I get this error:
Unable to start debugging on the web server. The debugger cannot
connect to the remote computer. The debugger was unable to resolve the
specified computer name.
I don't understand that when I want to debug my project locally, what "Remote computer" it's talking about??!!
Please help me guys, this is my first task in this company and I have to overcome this error.
Check all the steps outlined here: https://msdn.microsoft.com/en-us/library/dwesw3ee.aspx?f=255&MSPPError=-2147217396
If you're using a hosts file, make sure you have an entry for the site in question. That was the problem for me, when I encountered this message.
I have similar problem.
My first solution delete url site from iis repositories and project properties write localhost and port number if is it. And debug began working without restart. I also think, may be if add new url in windows host file this can fix this trouble but may be need restat iis or visual studio.
IIS
Project properties

How to fix lost connection to Access Database after Deploying ASP website to IIS?

I am fairly new to ASP, so if anything doesn't make sense, or you think, "WHY WOULD YOU DO THAT?", it's becasue I really didn't know.
So the issue is that I created a Website using Visual Studio 2012 Express for Web. It was an ASP.NET MVC. I have spent over a week, working on this, doing testing and getting everything to work and look correctly. So I started the process of deploying it. I followed a couple guides, and felt like I did everything correctly.
Right now I am only trying to test my website on , and my first screen shows up. This screen is a "login" screen of sorts and is supposed to connect to my Access Database to check to see if a user should be admited to the next screen. But clicking the "Submit" button doesn't even open the Database. All of this works fine when I run it in Visual Studio.
What can I do to get this working?
Some steps I have tried and failed at:
-Redeploying
-Changing location of the Access DB
-I started to try to install configure and convert my Access Database to SQL Server, but I haven't been able to get that to work either.
If anyone has any suggestions, please let me know. If you need code examples or IIS settings, I will get them to you as fast as I can, but please help me because I don't want to have lost over a week of work.
Thanks,
D
Edit: After taking the suggestion from HansUp, it lead me to some other search terms that lead me to http://www.iis.net/learn/application-frameworks/running-classic-asp-applications-on-iis-7-and-iis-8/using-classic-asp-with-microsoft-access-databases-on-iis. I am using a 64-bit machine, and my application pool in IIS was not set to run 32-bit applicaions which when using Access ODBC drivers that are 32-bit casue a problem.
Set the IUSR account to Read/Write for the DB file and folder where the DB file is located.
Then, seeing as I was using a 64-bit machine, and the Access ODBC drivers that were being used were 32-bit, I had to set "Enable 32-bit Applications" to "true" in IIS, for the Application Pool that my site was using.
This is a link to where I found the 64-bit 32-bit solut
http://www.iis.net/learn/application-frameworks/running-classic-asp-applications-on-iis-7-and-iis-8/using-classic-asp-with-microsoft-access-databases-on-iis

How to load Crystal Report from database in MVC 4? [duplicate]

I am trying to run a crystal report from my web application which was built using ASP.NET 4.0 and Visual Studio 2010. I have installed the following from the SAP site (http://www.businessobjects.com/jump/xi/crvs2010/us2_default.asp)
1) SAP Crystal Reports, version for Visual Studio 2010 - Standard EXE installation package which installs the software into the Visual Studio IDE.
2) SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit)
I have a page called Reports.aspx in which I have a crystal report viewer control
<CR:CrystalReportViewer ID="rptViewer" runat="server" AutoDataBind="true" />
In the Reports.aspx.cs file I have the following code:
protected override void OnPreRender(EventArgs e)
{
ReportDocument report = new ReportDocument();
var path = Server.MapPath("Reports/Sample.rpt");
report.Load(path);
report.SetDatabaseLogon("username", "password", "servername", "databasename");
rptViewer.ReportSource = report;
}
On the report.Load(path) line I get the following error:
Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack.
How can I fix this?
I also got into the same problem my problem was report path was not valid, May be you have same problem , check Server.MapPath("Reports/Sample.rpt") returning valid path ?
make sure the report is in app_code folder
initialize a new instance of it instead of initializing a reportdocument and loading the report in it.
Sample report = new Sample();
this worked for me
You will need to modify two properties in the .rpt files:
Build Action is set to "Embedded Resource" by default. Change it to "Content".
Copy to Output is set to "Do not copy" by default. Change it to "Copy always".
Rebuild, Build deployment package and Publish. Done!
NOTE: Below, the term "WebSite" refers to actual web site nodes in IIS, NOT a virtual directory within a web site.
Problem Root Cause: There is no "aspnet_client" folder accessible by the application.
This can happen for several reasons:
Since the SAP CR installer appears to install the aspnet_client folder in the ...\inetpub\wwwroot\ folder, if your Web Site physical path is NOT ...\inetpub\wwwroot, your application will not have access to the aspnet_client folder.
If the aspnet_client folder was moved or deleted from to the top level of your web site's physical path, your IIS application will not have access to the folder.
Problem Solution (For Windows Server 2008 R2)
Go to the IIS manager on your server
Expand the tree view node for the WebSite running your application
Look at the level immediately under the web site node and ensure you see a "aspnet_client" folder.
If you do see the folder, then perhaps this root cause is not the cause of your problem.
If you do NOT see the folder, search the server's hard drive for it and COPY it to the Web Site's Physical path.
Right mouse button click on the Web Site node and click Refresh from the popup Menu
You should now see the aspnet_client folder at the level directly under your web site node and the reports in the application should work.
I ran into this when I converted a web site to a web application. The report would run fine on my dev machine, but not on the server. Then I realized the rpt file was missing on the server!
By default the report files were considered embedded resources and were not copied when the web application was published. I just changed them individually, republished the site, and all was well again.
I have also had a report load failure if I have mistakenly left the report file open in crystal reports designer.
This error is a real treat, and seems to have many possible antecedents. Fortunately I only wasted a day on my particular variation:
ReportDocument.Load() also makes a local temp copy. (This may only be in the case of a load from a network drive location, I didn't test this in the case of a local load.)
If the user context under which the load occurs does not have authority to create the temp file locally, Load will fail with the same very unhelpful error.
Also, I ended up diagnosing this with Process Monitor. It may be helpful for you as well.
Please make sure your report rpt files are in their original folder. I got the same error first, after I "published" my MVC web site to IIS. I didn't realize that "Publish" didn't put rpt files in the package.
Re-install the "Crystal report engine" to the server
Build Action set to "Content".
It perfectly worked for me..!

Trying to call svn.exe from batch file called by .NET webpage - odd results

The situation: I have a mvc.net web page which, when called, runs a batch file on my server using System.Diagnostics.Process.Start and cmd.exe. The batch file contains a line that runs "svn.exe update myfilepath" and should therefore update the files on the server.
What's happening?
- the batch file is running, but the call to svn.exe does nothing, nor produces any error messages.
- if I run the batch file by double clicking, the svn command DOES run successfully.
I guess this is a security issue, but I'm no expert on this and I cannot make any headway.
The site is hosted on Windows Server 2008 R2 and the app pool is using the ApplicationPoolIdentity system. I have tried running the app pool as Network Service and also adding Network Service as a user that can Read/Execute to svn.exe.
Please help!
This could be proxy related. It's possible that you access the Internet via a proxy, but that the user profile for the app pool identity isn't configured like this. You may need to use a domain account that you can log on as in order to create a suitable user profile. You will also need to make sure IIS is loading the profile by ticking the appropriate option.
(Another possibility is that the working directory for the process you are starting is not set correctly to the root of your Subversion working copy. We've established this wasn't the problem in your case.)

Can't resolve "UnauthorizedAccessException" with MVC 2 application running under IIS7

We use MVC controllers that access System.File.IO in our application and they work fine in localhost (IIS 6.0-based Cassini). Deploying to IIS7, we have problems getting the controllers to work because they throw UnauthorizedAccessExceptions.
We have done the following to try to resolve the issue:
- Set NETWORK SERVICE and IUSR accounts to have permission on the files and folders in question
- Ensured the App Pool is running under NETWORK SERVICE and loading the user profile
- Application is running under full trust
- We tried adding impersonation to web.config and giving NETWORK SERVICE write permissions (which was not a great idea because that's not what we want to do)
Now, we alternate between getting UnauthorizedAccessException and an IIS7 404 page that suggests the routes are being ignored completely (for example we serve "/favicon.ico" via a controller when the physical file actually lives at /content/images/favicon.ico). We used ProcessMonitor to try to track down the issue but weren't successful.
UPDATE:
This issue is intermittent. We had a brief few minutes where everything worked without making any configuration changes. We're running on EC2, so this could be related to a distributed file system. We're also using a separate drive to store all web site data, we're not using inetpub/wwwroot.
UPDATE 2:
The site works without incident under IIS 7.5, with no configuration changes needed but this is likely due to running with the new AppPoolIdentity. Otherwise it's an identical deployment. Unfortunately we can't run R2 on this EC2 instance.
One of the ways to identifying the cause is using Procmon tool from Sysinternals
Procmon will show the reason for unable to open the file , it will also show who is holding the file.
The issue turned out to be the controller factory we were using not handling file requests properly.

Resources