Debugging Azure - An error occurred loading a configuration file - debugging

I can debug my application fine but if I debug the Azure project, it loads the compute and storage emulators, loads the browser and goes to 127.0.0.1:81 and then I get the error:
Description: An error occurred during the processing of a
configuration file required to service this request. Please review the
specific error details below and modify your configuration file
appropriately.
Parser Error Message: An error occurred loading a configuration file:
Access to the path 'C:\Users\Projects\Web\views\web.config' is denied.
I am using November 2011 Azure SDK and Visual Studio 2010 SP1 in admin mode with IIS7.
If I publish the website to Azure then everything works fine, it's just a debugging issue.
EDIT
Ah, it needs to be running under C:\inetpub\wwwroot to debug the Azure project. How can I get it to work outside of that directory?

Windows Azure does not change anything with respect your ASP.NET configuration instead it just use the same ASP.NET application and configuration to run your application in compute emulator. So when you run your application in compute emulator the whole ASP.NET project runs from the same folder where your application was and in IIS you can verify as the image below:
I am very much suspecting that by any reason the folder/file is read only that's why web.config is not accessible. I believe you should investigate this problem from your drive/files security and accessing point not from ASP.NET/Azure perspective because I dont see any error over there..

When debugging the web project I was using Cassini. When debugging Azure it uses IIS.
I had to add the user account of NETWORK SERVICE to my solution files.
To access the local database when debugging Azure locally, the database needs the user NETWORK SERVICE adding to it.

If you have source control, I think there is sometimes an error if the web.config file has the readonly attribute set on it in the file system. I'd check there first.

Related

Sitecore Cannot open database "marktwoSitecore_Web" requested by the login. The login failed. Login failed for user 'blah''

I am currently trying to set-up a Sitecore project on my PC. When I go to view the project on my browser I get the following error:
Sitecore Cannot open database "marktwoSitecore_Web" requested by the login. The login failed. Login failed for user 'blah''.
These are the steps that I have carried out so far:
1) Firstly there are three types of sitecore installations to do:
- Complete
- Database only
- Client only
I have gone with the Client only installation.
2) The Sitecore "Client-only" installation instance was made inside the inetpub/ wwwroot folder.
3) I then made a visual studio project
4) I made a folder called "Libraries", which is located in the root of my visual studio project solution. I copied over all the relevant Sitecore.dll's from the wwwroot project to my visual-studio project into the Libraries folder. I also replaced the Default web.config file in my Visual studio project with Sitecore's version of Web.config. And then I added Sitecore references to my Visual Studio project.
6) With all of the initial configuration done; I set-up a publish profile so that I could publish my C# code to inetpub/wwwroot project. I did step four so that my publish would not overwrite sitecore dlls.
5) I changed the Connection strings in App_Config/ConnectionStrings.config to point to the Web, core and master sitecore databases. That were created during the Sitecore installation.
Those were the steps I did prior to getting the error about invalid login credentials. I am not sure why I am getting this error; since I went into Microsoft SQL server Management Studio and I gave the user "blah" admin rights to all of the datbases: Master, web and core.
Any support and guidance would be greatly appreciated; as I am unsure of how to address this problem
This error is happening because the web database referenced in your Website/App_Config/ConnectionStrings.config is either not there or the permissions are not set properly on that database. The easiest way to troubleshoot is to load SQL Server Management Studio specifying the host, username and password that are in your connection strings and see if it connects. It sounds like you are probably logging in with your Windows user when you are making the changes listed above.
You could try making the blah user a "db_owner" to see if that helps or your local instance may not be in "mixed authentication mode" which allows for named users and windows users. You can change that in the settings, but you need to restart the service for it to take effect.

How do I debug my Azure web role in Visual Studio 2012?

I know this is probably something really stupid, but I've been searching google for 2 hours to figure this out.
I have a new test Azure app that I would like to debug in Visual Studio. If I set the startup project to the Web Role (MVC) project, I can hit breakpoints in VS, but it's not running in the emulator so all of my Azure calls fail.
If I set the startup project to the Cloud project, the emulator starts, then Visual Studio ends debugging and my web role is never launched.
What am I missing here? How do I launch my web page and still have access to the emulator?
(Side note.. why isn't there a Visual Studio 2012 tag??)
Although this doesn't answer your question directly, I always make sure that my projects run outside of the emulator. If for nothing else, this just greatly improves the efficiency of your development.
To avoid the issue of the Azure calls failing, one very basic practice you can use is to use a Dependency Injection framework (such as Unity or others) and create a LocalConfigurationManager and a AzureConfigurationManager which both implement some interface like IConfigurationManager, then if your code needs to ask Azure for an instance number, or config setting, etc... the LocalConfigurationManager can just return a hard coded number/setting, and the real AzureConfigurationManager will actually call Azure.
The trick is to use the Web.Debug.Config and Web.Prod.Config files (or perhaps just use the #IF DEBUG C# precompiler statement) to change the implementation depending on the build config.
I have just created a Azure project with an MVC Web Role and I was able to hit a breakpoint in a controller action without any issues. Some things to check:
Do you have a WebRole.cs file in your MVC project containing a class derived from RoleEntryPoint?
Is there a node in the Roles folder of the Azure project representing your MVC project?
When you run the Azure project does the Compute and Storage emulator icon show up in the Notification Area of the taskbar?
Does the ServiceDefinition.csdef file in your Azure project contain a Web Role node with an attribute matching your MVC project name?
WebRole name="MvcWebRole1" vmsize="Small"
As a quick test try creating a new Azure project with a MVC Web Role, add a controller with a single action that returns a view and put a breakpoint in there. Then set your Azure project as the "Startup Project". If everything is working correctly you should hit the breakpoint when you debug the Azure project.
I un-installed and re-installed all my Azure SDK's, to no avail.
This link
Debugging Azure: Error attaching the debugger to the IIS worker proccess
told me where to look for the error that was causing it to fail, which led me to this link:
http://social.msdn.microsoft.com/Forums/en-US/windowsazuredevelopment/thread/07fe087e-4ac3-4c4f-bd62-4fccff4afd45
The ACL on the Windows Azure registry entries were not in "canonical order".
All you have to do is fix that and this error goes away.
These are the steps I took:
1.) regedit, navigate to HKLM\Software\Microsoft\Windows\Windows Azure
2.) Right-click, choose "Permissions". You will get a warning that the
security information is incorrect and you get a button labelled "Re-Order".
Click this and the security information then shows up as normal.
3.) Follow the same steps for the Windows Azure AppFabric and Windows Azure Emulator
registry entries in the list after the Windows Azure entry.
Problem Solved!
Note that I found the key under HKLM\Software\Microsoft\Windows Azure, not under Windows\Windows Azure.

Debugging an existing sharepoint solution

I've recently mapped a sharepoint solution from TFS to a local directory and successfully 'got' the latest version.
It wasn't building, but this was because of there were no Site URL's in the properties of the several projects included in the solution. So, using central admin, I created a new web app (the port 36352). U then added the url and port to the Site Url and it's now building fine.
However, when I go to run with the debugger I get the following two errors:
Error 2 Error occurred in deployment step 'Recycle IIS Application Pool': Cannot connect to the SharePoint site: :36352/">http://:36352/ (deleted url for security reasons). Make sure that this is a valid URL and the SharePoint site is running on the local computer. If you moved this project to a new computer or if the URL of the SharePoint site has changed since you created the project, update the Site URL property of the project.
AND
Error 3 Program 'Path.PowerShell.exe' (deleted path for security reasons) does not contain a static 'Main' method suitable for an entry point
It seems that the first error is related to the way in which I've 'connected' it to the new web app I've created - have I done this part right?
The 2nd error seems to be with regard to the entry point at which the debugger should execute, but this is a sharepoint site - so I just want to run the site (has VS not identified this as sharepoint somehow?).
Thanks a LOT for any help.
I got this exception when I had the solution on a different server. Make sure your solution is on the same server as the SharePoint web application. When you run the solution, Visual studio packages the solution and tries to deploy it onto the URL you specified in the properties. If your project is a farm solutions such as visual web part then make sure you have rights to deploy.

VS2010 Error in Recycling IIS Application Pool: Not Found

I'm making a Sharepoint visual web part in Visual Studio 2010 and it seems like out of nowhere I started receiving the error: "Error occurred in deployment step 'Recycle IIS Application Pool': Not found"
In the output for my program it says which application pool it's looking for and I know it exists because it shows up in IIS Manager
Now I've already tried resetting IIS, along with recycling the application pool manually in IIS Manager.
Really I'm sort of at the end of my rope and any help would be greatly appreciated.
This usually happens when the user that has run Visual Studio doesn't have rights to Recycle the IIS application pool.
To solve this, run visual studio with some user who has rights (shift + right button -> run as different user) or try to follow this:
http://msdn.microsoft.com/en-us/library/aa954062%28v=bts.70%29.aspx
The simple solution for the above issue is
Step1:Close the Visual Studio
Step2:ResetIIS
Step3:Open Run and Enter Services.msc, Restart the "Windows Management Instrumentation" service
Step4: Recycle the Application pool in inetmgr.
Step5:Reopen the VisualStudio now deploy.
Hope it will help others.
Thanks & Regards
Kishore Appini
When I experienced the same error, checking the following helped me:
Make sure the Web Application exists on SharePoint.
Make sure the site collection you are trying to deploy to, exists.
This is the siteURL specified in your project's properties. To see
this property, you have to press the F4 key after selecting the
project in solution explorer (in Visual Studio).
In my case, I had not created the site collection and also the siteURL had a previous server mentioned in it.
You need to set the 'Site URL' correctly in the project properties.
click on your project name in the solution explorer and press F4 for properties.
Then check the Site URL.
The Site URL must be the same as Project Server URL.
example http:// spsw001/pwa
This solved the problem when I got this error message.
This must be the solution for the scenarios:
http://praveenbattula.blogspot.in/2013/07/error-occurred-in-deployment-step.html
If you have a public URL for your collection which is a DNS entry that is pointing to your SharePoint server then what you need is an "Alternate Access Mapping".
Go to Central Admin > Application Management > Configure Alternate Access Mappings and create an internal URL for your public URL.
Set your project server url property to point to the newly created alternate access mapping and it should work.
Note: This is valid for SP 2013
In my case it was due to missing database permissions. As mine was a DEV box, I just added my Windows account (=the account I was logged into the DEV server) to SQL Server as sysadmin.

"The resource cannot be found" when I hit F5 in Visual Studio 2010

I have a .NET 3.5 web application that I am trying to run in my local development environment.
Every time I hit F5 to run the application, I get the following error:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Default.aspx
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3614
I am running Visual Studio 2010. This web application runs perfectly on our production server, but I can't seem to get it running on my local development box.
Any suggestions on how I can troubleshoot this?
Looks like it's looking for a local web server, because your URL is /Default.aspx. You might need to point it to the actual server.

Resources