I want to publish a MVC5 project to local IIS, I need to correct set connection string, Permissions and application pool in IIS and every things that help me to do it.
When I publish, I see this error.
Cannot open database "MyProjectDB" requested by the login. The login failed.
Login failed for user 'WORKGROUP\DESKTOP-1O5A46C$'.
I solved this problem.
Create a text file (a.txt) in my pc desktop and chenge to (a.udl).
open (a.udl) and set Connection
and test connection
if success then close udl window.
then open with note pad (a.udl) and copy
Integrated Security=SSPI; Persist Security Info=False; Initial
Catalog=MyProjectDB; Data Source=.
and Replace to default connection string in Connection String to your Website in IIS.
Related
C# ASP.NET MVC web application - I followed all the steps from https://blogs.iis.net/davidso/azurefile in order to be able to access my Azure location by unc.
My newly created local user is in the IISUSER Group and has the same username and pwd (storage key).
I then created an application in my website using a new APP Pool (integrated) w/said local user.
I ran the caspol command as well.
The issue I run into is when trying to do a file.SaveAs, I get an error
Incorrect username or password
Server.MapPath({application}) returns the correct unc path but doing a Directory.Exists won't locate the path.
When viewing the "connect as" with specified user in IIS I get no issues, additionally I can access the unc path directly from my local machine with same creds.
I tried going to the app pool of the application and set the user directly but no change there. Are there changes I need to make on the Website configuration that the application sits in? Prior to converting this to an application I initially had it configured as a virtual directory and got the same error.
Set the load user profile to "True" in the application pool:
try to set the azure user in iis anonymous authentication by clicking on the edit:
I've deployed an app to the IIS(and it works) and now I need to upload files to it. On Visual Studio I can upload files by running it with the admin role, but once published, it says that: "ASP.NET is not authorized to access the requested resource".
Anyone knows how to fix it?
Can you check the application pools for .Net Framework associated with the classic or integrated mode. if it is classic mode means, you have to change the integrated mode, then restart the IIS server. After successfully restarted IIS server, you can run the application now.
Step:
Go to application deployed folder location in Windows Explorer
Right click the main folder or specific folder or file, and then click Properties.
In the Properties dialog box, click the Security tab.
On the Security tab, you can see the list of users. If the Network Service account or ASP.NET account is not listed, add it.
In the Properties dialog box, click the Edit of Network Service or ASP.NET user name, and in the Permissions for NETWORK SERVICE section, select the Read, Write, and Modify permissions.
Click Apply, and then click OK.
you can see the screen by screen step following link
http://www.banmanpro.com/support2/permissions.asp
Edit:
Here's the screenshoot.
Right, this is driving me insane. This works fine locally with Excel 2013, but when the website is published to a remote server with Excel 2010 it fails. From what I can see the DCOM configuration is the same locally as remote.
After fighting with Excel 2010 and DCOM permissions for over an hour now the best I have got is this exception: System.Runtime.InteropServices.COMException (0x80070BBC): Office has detected a problem with this file. To help protect your computer this file cannot be opened.
This is the result of a web application trying to open a *.xls file from a location it has just uploaded to. The application pool is running under ApplicationPoolIdentity and I have set the permissions for this specific app pool under mmc -32 on Launch and Activation Permissions so there's no problem running Excel. What I think I'm facing here is protected mode issues as the file is definitely not corrupt.
I've gone into Excel and Trust Centre settings and have added the location where the *.xls file is uploaded to (and subsequently opened) as a trusted location. If I open the file on the hosting server (under my domain account) I don't get the protected view block on the file - however, the Identity on the DCOM configuration is set to the launching user. So, what does this mean from the following (or something I haven't listed):
I need to add this location as trusted at a group policy level because the account launching the actual application doesn't have this configuration in its profile?
I need to create an actual account on the server and use this account as the Identity for running the application?
... ?
Just to clarify I've already been down the DCOM Security config route and RIDICULOUS issues with C:\Windows\System32\config\systemprofile\Desktop and C:\Windows\SysWOW64\config\systemprofile\Desktop. The configuration is:
.NET 4.5 (classic pipeline) app pool running under ApplicationPoolIdentity
DCOM Config > Security > Launch and Activation Permissions all set for this specific identity (Access Permissions and Configuration Permissions all set to Use Default)
File is uploaded correctly and appears in destination, opening on the server itself (under my domain account) respects the Trusted Location and doesn't give protected mode warning
Process to parse fails with the above exception.
Here is a screenshot of the Interop assembly I'm using if this is pertinent.
Ok... for anyone stumbling on this issue I have bitten the bullet and had to do the following:
Create a local account (AutomatedOffice in my instance) and set DCOM config to run Excel under this account
Log in as above account and change Excel settings to add folder in application root to trusted location and disable protected mode messages
Allow "Network Service" to invoke DCOM processes locally (through server DCOM config and not CLSID config)
Add NTFS permissions for this account on C:\Windows[System32|SYSWOW64]\config\systemprofile\Desktop paths
What was weird, after creating the account I was getting the following exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. which was resolved by adding HOST\Users and HOST\NetworkServices group to DCOM security (local only!!!) settings.
You need to add in trust center, security locations the folder where your website is published, for examplo if your website reads a file from c:\temporal\ you must put on excel, security locations that folder name
I copied an MVC project from another development pc to my laptop and tried to deploy it on the laptop which gave this error. The user account password was changed recently prior to this error. I tried tinkering around with the app pool permissions for the root folders with no effect. Any ideas? I am stuck.
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x8007052e
Config Error Can not log on locally to C:\inetpub\wwwroot as user {MY ACCOUNT} with virtual directory password
Config File \?\C:\inetpub\temp\apppools\ASP.NET v4.0\ASP.NET v4.0.config
Requested URL http://localhost:80/hts
Physical Path
Logon Method Not yet determined
Logon User Not yet determined
Config Source
145: <application path="/" applicationPool="ASP.NET v4.0">
146: <virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" userName="{MY ACCOUNT}" password="[enc:AesProvider:{etc etc etc}:enc]" />
147: </application>
Open the Internet Information Services (IIS) Manager (Start > Run > type "inetmgr").
Using the navigation pane on the left, browse to Sites > Default Web Site.
Right-click on Default Web Site and select Manage Web Site > Advanced Settings.
Set the Physical Path Credentials field to Application user (you must enter user and password).
Click OK and then OK again.
Right-click on Default Web Site and select Manage Web Site > Restart to refresh the changes that were just made.
At this point you should be able to reload the page in your browser.
Open IIS Manager
Select the site. Default Web site in my case and click "Basic Settings..."
This opens the Edit Site dialog.Click "Connect as".
In the Connect As dialog, click Set and provide the new password in the Set Credentials dialog.
Come back to Edit Site dialog and click "Test Settings..."
Once the connections succeeds, you should be able to successfully open the site in your browser.
I ended up reinstalling visual studio and eventually got everything working.
I deployed my asp.net mvc 3 project under IIS 7 (Windows 7). Project contain attach *.mdf DB file in App_Data folder. First I got following error:
Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.
I removed it so change connection string in my web.config file - remove user instanse=true and in Application Pool -> Addvanced Setting -> Process Model -> Load User Profile set value TRUE and then I got next error:
CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:\inetpub\wwwroot\assign\App_Data\AssignmentDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
my connection string is
<add name="AssignmentDBEntities" connectionString="metadata=res://*/Models.AssignmentDBModel.csdl|res://*/Models.AssignmentDBModel.ssdl|res://*/Models.AssignmentDBModel.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\AssignmentDB.mdf;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
I don't known how resolve this problem..((
someone can help me?
The account you're using to connect to the database (specified in the connection string) doesn't have a CREATE DATABASE permission. You need to grant this permission in order to be able to create database.
You can just execute sql command (http://msdn.microsoft.com/en-us/library/ms178569.aspx) or use Enterprise Manager to grant permission.
The user you need to grant the permission to is the one specified in the connection string or the account your website runs under if you're using integrated security.