Access issue on App_data mdf file of website - c#

I am stuck into the deployment of website from installshield limited edition where I have a database file in the App_Data folder along with this I have one scheduler functionality into website, for this I have created a Windows service and calling though the WCF call.
Now I am accessing the .mdf file from the website as well as WCF with the edmx.
But the problem is once I deploy the website at IIS and if I start the Windows service manually from that point on, I am getting the access issue such as
Cannot open database "C:\INETPUB\WWWROOT\XYZWEBSITE\APP_DATA\XYZ.MDF" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\DefaultAppPool'.
If I stop the Windows service then it works, and vice versa.
Anyone gone through this situation and got any ways to get the work done?
Waiting for reply
Thanks in advance

Related

Automatically update local client website that running on IIS manager

I have a website that running locally on IIS Manager. Every time when I update website, I communicate client via Anydesk and update its file. Whenever the client got any update from server than it should be automatically updated.
I got it solution to push dll file on GitHub. When customer click on update button GitHub file download automatically in where website hosted folder. The problem is here when I replace updated file, it will give an error 'The process cannot access file, because it already used'.
If this solution is correct, kindly guide me how to overwrite file while application running on IIS manager without stop application
Otherwise give me suggestion to update file from online window server to local IIS manager without closing application.
Currently, in ASP.NET Core apps, it is impossible to replace binaries when the application is still running, but it will possible in .NET 6 by Shadow-copying in IIS.
You should consider the Blue Green deployemnt for your app https://docs.cloudfoundry.org/devguide/deploy-apps/blue-green.html
Options that I can suggest for your:
Move app to the cloud provider and use their features. For example Azure has Load Balancer/Traffic Manager/Slot deployment that can solve your issue
You can play with IIS Load Balancer: https://learn.microsoft.com/en-us/iis/web-hosting/scenario-build-a-web-farm-with-iis-servers/configuring-step-3-configure-iis-web-farm-load-balancing#:~:text=To%20configure%20load%20balancing%20with,Open%20IIS%20Manager.&text=Under%20the%20server%20node%2C%20expand,list%2C%20and%20then%20click%20Apply.

Umbraco 8 shows install screen after deploying on GoDaddy server

I have developed site using Umbraco 8 and uSkinned theme. I am able to run in my local development environment as well as local IIS. but when I deploy it to GoDaddy it shows me install screen.
I followed below are the steps.
Visual Studio Publish to folder.
Using above published folder I hosted site to my local IIS(it works on IIS)
I have created backup of database
Restored backup to GoDaddy SQL Server. I checked after restoreing, tables and data is there on GoDaddy SQL Server(I used LinqPad).
I used publish output created on step 1 and updated connection string and uploaded to GoDaddy.
When I browse site it shows me install screen.
Why it shows me install screen even if it has data in database as well as same set of file as IIS local? What I am missing.
Thanks for help
Edit
I get below logs
{"#t":"2021-03-24T11:50:03.7387476Z","#mt":"{EndMessage} ({Duration}ms) [Timing {TimingId}]","EndMessage":"Booted.","Duration":1592,"TimingId":"6f43df2","SourceContext":"Umbraco.Core.Runtime.CoreRuntime","ProcessId":1700,"ProcessName":"w3wp","ThreadId":29,"AppDomainId":3,"AppDomainAppId":"LMW3SVC8ROOT","MachineName":"S107-180-73-24","Log4NetLevel":"INFO ","HttpRequestNumber":1,"HttpRequestId":"75319e5f-ad35-4c7b-9aa2-fe04a05c9007"}
{"#t":"2021-03-24T11:50:04.1450357Z","#mt":"New url {Url} detected, re-discovering application url.","Url":"http://yourmodern.skinfogroup.com/umbraco","SourceContext":"Umbraco.Core.Sync.ApplicationUrlHelper","ProcessId":1700,"ProcessName":"w3wp","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC8ROOT","MachineName":"S107-180-73-24","Log4NetLevel":"INFO ","HttpRequestNumber":2,"HttpRequestId":"7f3c5e24-22d0-4cc8-940d-13b6e8622a9f"}
{"#t":"2021-03-24T11:50:04.1450357Z","#mt":"ApplicationUrl: {UmbracoAppUrl} (UmbracoModule request)","UmbracoAppUrl":"http://yourmodern.skinfogroup.com/umbraco","SourceContext":"Umbraco.Core.Sync.ApplicationUrlHelper","ProcessId":1700,"ProcessName":"w3wp","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC8ROOT","MachineName":"S107-180-73-24","Log4NetLevel":"INFO ","HttpRequestNumber":2,"HttpRequestId":"7f3c5e24-22d0-4cc8-940d-13b6e8622a9f"}
{"#t":"2021-03-24T11:50:04.5356961Z","#mt":"Umbraco must install or upgrade.","#l":"Warning","SourceContext":"Umbraco.Web.UmbracoModule","ProcessId":1700,"ProcessName":"w3wp","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC8ROOT","MachineName":"S107-180-73-24","Log4NetLevel":"WARN ","HttpRequestNumber":2,"HttpRequestId":"7f3c5e24-22d0-4cc8-940d-13b6e8622a9f"}
EDIT 2
I validated that connection string correct. I am able to connect to the database and execute queries. I have also validated that it has same no of tables and rows.
This Umbraco forum thread says it could be a permissions issue: https://our.umbraco.com/forum/using-umbraco-and-getting-started/102946-moving-umbraco-v8-to-new-server-fails-you-see-this-screen-because-your-umbraco-installation-did-not-complete-correctly#comment-322275 - specifically the part in there about
changed the permissions on the server (by creating a new sql server
user and login with the same rights)
Heres my debuggin tips:
Have you upgraded? Have you copied the DB into live, or, you using a fresh DB?
How are you doing your transforms? Perform a file compare between files using a tool like Beyond Compare
Delete contents of Add_Data
Install screen can be triggered if Umbraco.Core.ConfigurationStatus is not populated
See this for details:
https://www.jondjones.com/learn-umbraco-cms/umbraco-7-tutorials/umbraco-upgrading-guide/how-to-reinstall-umbraco/
There was issues with the server. I validated this by.
Hosting same website on other server(works)
Hosting website with default data on same server(does not works).
Edit
Rebuilding server did not fix the issue.

Access bat file outside web folder in c#

What I am trying to do:
I have a bat file that I want to execute via a button on the web page. This web page will then execute the command responses while the process is running.
I have managed successfully to get the bat file to run on my button click and output the responses on the page on my localhost, however I am sure I will encounter permission issues when I deploy my app onto qa,staging,production server. The reason being because the bat file is outside the web folder and I'm sure the error will be something like Access Denied
The web application is run using form authentication on a win2003 running IIS6.
The bat file is outside the web root as it sits under a application we deploy via a wix that includes a suite that has services, libraries, etc under it.
I thought about using impersonation but when looking on the web all the examples I found were for Windows authentication so I'm guessing I can rule this option out.
Any advice will be much appreciated
Kind Regards
Zal

WCF service works in cassini, but not in IIS

I created a service that has a database connection which is working fine in Cassini, when in copy the service to the inetpub all works fine except database calls, they always return this error:
The server encountered an error processing the request. See server logs for more details."
Now i have 2 questions,
I can find server logs in my C:\inetpub\logs\LogFiles\W3SVC1 folder. But are these the ones mentioned because these do not seem to contain any usefull data.
How is it possible that everything works in Cassini but not in IIS?
If there are any questions about my question please go ahead!
Edit I am using Visual studio team system 2008 and IIS 7.0
This is normally a permissions problem.
If you are using defaults:
The connection string is using a trusted connection
When you run via cassini you are in the security context of your user
When you run via IIS you are in the security context of the identity of the application pool which is network service.
To fix it you could:
change the connection string
change the identity of the application pool
give network service access to your database
Run Visual Studio as administrator
My guess is permissions. Are you using Windows authentication?
In the case of Windows authentication:
http://www.codeguru.com/csharp/.net/net_security/authentication/article.php/c7725

Accessing SharePoint content (list) from a WCF service

I've written a WCF service which tries to read the list items from a particular list in SharePoint. For testing purposes I run the WCF service using Visual Studio ASP.Net Development server. I pass the Site ID to the web service and from the web service I try to open the List and read the items. But when I try to read the items I'm getting the following error -
This operation can be performed only
on a computer that is joined to a
server farm by users who have
permissions in SQL Server to read from
the configuration database. To connect
this server to the server farm, use
the SharePoint Products and
Technologies Configuration Wizard,
located on the Start menu in
Administrative Tools.
Here are some facts -
I'm using SharePoint 2007 x64 in
Windows Server 2008 x64 and it is a
single server installation (no farm)
I'm a Farm administrator
I'm a System Administrator (but not
domain administrator)
I'm a SysAdmin for the SQL Server
2005 server in which is SharePoint
is having its databases
I'm the Site Collection
Administrator in which the List is
present
I opened Visual Studio 2010 as
adminsitrator
In task manager, the ASP.Net
development server process is
running under my account
I don't have any idea why I'm getting that error. Any ideas?
is the WCF service runnig on the sharepoint computer ? I bet you are trying to use the SharePoint object model outsite the sharepoint box.
If you want to access remotely to the sharepoint data, in a WCF service on your own, or actually any other program, you will have to use the Lists.asmx web service to retrieve your data from sharepoint.
In fact, in your WCF you will have to act as a client to the SP services
[edit] my bet was wrong :) here is another thing to check
Also take a look in your VS project. Setup your target platform to "AnyCpu" or "X64" to ensure the program will use the correct assemblies and registry keys.
The object model will try to open the reg key under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node node if you process is 32 bits, instead of HKEY_LOCAL_MACHINE\SOFTWARE where the sharepoint config resides
Try to check your sharepoint application pool identity. If you, for example, trying to evelate you priviligies using RunWithEvelatedPrivilegies in your service, and app pool identity doesn't have required permissions, you will get such message.
Okie. I found the issue. It is related to the same problem which I've been facing since I switched to x64 development in SharePoint 2007. When I deployed the WCF service to IIS everything worked fine.
Using Visual Studio 2010 (no matter what my target platform of my project is) I've never been able to access SharePoint content through a simple console application or a simple asp.net web application. I've clearly understood that the problem is with the x86 x64 stuffs and I've not been able to resolve it till now. I've been haunted by this for so long now.
If you have any comments on this answer please post it.
Old Ref - Filenotfound exception while opening an SPSite object - x64

Categories

Resources