I new to ASP.NET development and I have managed to deploy VirtoCommerce to my local machine IIS (windows 8.1) following the documentation on http://docs.virtocommerce.com/display/vc2devguide/Deploy+web+applications+to+dedicated+server .
When I tried to deploy it in Azure VM running Windows server 2012, I got the following error when I tried to run the frontend page. The dll mentioned below is definitely in the /bin folder of the store.
Server Error in '/' Application.
Could not load file or assembly 'LibSass.x64' or one of its dependencies. An attempt was made to load a program with an incorrect format.**
I followed the link
Could not load file or assembly 'LibSass.x64' or one of its dependencies in VirtoCommerce but found no luck. What did I miss on this deployment ? Any help is much appreciated, thank you.
Are you running 64 but machine and IIS Application Pool as 64 bit? If not, make sure to go to IIS and configure pool settings to run as 64 bit process. The easier approach will be to follow the guide here: http://docs.virtocommerce.com/display/vc2devguide/Deploy+from+GitHub+to+Microsoft+Cloud+Azure which will setup Virto Commerce as a website in IIS with all correct configuration for IIS. You can then update it manyally by simply uploading site through FTP if you want. You can also clone the repository on GitHub and that way your azure site will auto update on every checkin.
I was able to reproduce this error on a clean Windows Server 2012 Standard. It turned out that Libsass.Net requires Visual C++ Redistributable Packages for Visual Studio 2013. After installing the vcredist_x64.exe the error has gone.
Related
:( Oops.
500 Internal Server Error
An error occurred while starting the application.
This message came out when I added database functionality to my asp.net core app and deployed it to iis. When I developed it in Visual Studio, everything went well. But after deploying, this error messages appeared.
I tried to use dotnet myapp.dll to run my app in the deploy folder, and found out it worked well. It is likely that the problem is relation to iis. I tried to add <compilation debug="true">..</compilation> to web.config, but it seems useless. What is problem are actually, or is there any other way to see the detailed error info to help find out what's happened?
Change stdoutLogEnabled="false" to true and then check the logs at stdoutLogFile=".\logs\stdout". The error(s) there might tell you something.
Check that you set up right Environment Name using ASPNETCORE_ENVIRONMENT environment variable as so use correct settings like connection string. On your machine by default you have "Development" environment.
You may use Error Handling middlewares for showing exceptions like
app.UseDeveloperExceptionPage();
Had the same issue. Here is the guide that helped me. Note, that I did not want to install the "Runtime" on the web server, but rather deploy all the necessary files as a stand alone app. Below are the steps in a more abbreviated form:
On your local PC, Determine which version to publish based on your server. I was targeting Windows Server 2008, R2 which meant i needed to publish win7-x64. Open a command prompt in your project directory and run the command below:
dotnet publish -c release -r win7-x64
This creates a publish folder containing hundreds of dlls, an .exe, and web.config located here: bin\Release\netcoreapp2.0\publish
On the web server with IIS, go to this landing page. Click the link for your desired version. Find the link for the Runtime and Hosting Bundle. Click to download and run.
Restart IIS by running this from an elevated command prompt:
net stop was
net start w3svc
Copy all of the files in your local publish folder to your desired application folder on the IIS server.
On the server, Open IIS, and create a separate AppPool and Application like normal. For the AppPool, under Basic Settings, change the .NET Framework version to No Managed Code. Make sure your Application in IIS points to your desired folder and the proper AppPool.
Test your web application in a browser.
In my case, I got this because I hadn't actually installed the latest 'DotNetCore.2.0.0-WindowsHosting.exe' on the windows server I was running it on... so it was working fine on my local machine in debug and error five hundy'ing on the server.
I had other non trivial to fix issues with the upgrade also... I'd advise avoiding it if you can.
Mark333's comment below solved my problem.
Quoting for easy reading:
"I'm using the normal publish provided by Visual Studio. And, I just
found out using the latest version of Hosting Bundle will fix the
issue. +1 on this
microsoft.com/net/download/dotnet-core/runtime-2.1.0-rc1"
I had to install for 1.1 since my app is a little older, but Hosting Bundle fixed it. In my case we deploy to a Docker image for our official environment, but when I want to do some testing locally I publish it and let my local IIS serve it up.
My problem was solved installing .netcore latest: https://dotnet.microsoft.com/download/thank-you/dotnet-runtime-2.2.2-windows-hosting-bundle-installer
https://learn.microsoft.com/pt-br/aspnet/core/host-and-deploy/iis/index?view=aspnetcore-2.2#install-the-net-core-hosting-bundle
Worked like a charm!
I had installed DotNetCore.2.0.5-WindowsHosting.exe on a Windows 2008 R2 Standard machine and encountered the same http 500 error. Logging didn't help (blank logs were generated - and Event Viewer logs were the generic ErrorCode = 0x80070002)
I had to do two things to solve my problem:
Give Read rights to the ApplicationPoolIdentity user (EG: IIS APPPOOL\AppPoolIdentityName) to the website directory and the application directory
I had to install IIS ASP Core under Server Manager (this felt weird, but it worked!)
I had the same issue.
My problem was that my connection string to db was not set in appsettings.production.json
And the internal server error 500 was to vague error message.
Changing the stdoutLogEnabled = true did nothing to me so i was not seeing any information about the error.
Make sure the App Pool has permissions to the folder where your app resides.
I experienced this issue. The problem was due to my local Sql Server instance. Remote connection were not allowed. So I manually restarted the SQL instance and my App restarted working fine.
I had similar issue after istalling dotnetcore-windowshosting using chocolatey while doing AWS ec2 instance bootstrapping.
When I checked my IIS modules AspNetCoreModule was missing.
This solved my issue. https://github.com/aspnet/IISIntegration/issues/434
I had to uninstall chocolatey package, restart machine and install it again.
Hope this helps!
In my case, I created a .NET 5 single file output, and I was getting:
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
The problem turned out to be that the EXE file was for some strange reason recognized as a virus by the protection software (CrowdStrike Falcon). Re-building without "single file output" option solved that problem.
There is an article called "Configuring IIS, ASP.NET, and SQL Server" which I highly recommend.
I followed the steps described there and my asp.net core app now communicates with my SQL database (after being published to IIS):
https://www.codeproject.com/Articles/674930/Configuring-IIS-ASP-NET-and-SQL-Server
It also happens when you install dotnet-hosting-bundle/dotnet runtime beofore IIS.
In this case re-install dotnet-hosting-bundle/dotnet runtime.
To be able to see the excetion's detail I just needed to change the ASPNETCORE_ENVIRONMENT to "Development" in the "IIS Express" profile in the launchSettings.json file. I aldo needed to create the corresponding appsettings.Development.json file to set the variables and data needed in my App. When the environment is Development net core send the detail exception by defaul. As we can read here in the official documentation.
I have a MVC 5 web application that is working fine. But due to internal security reasons and restrictions of my organization, I cannot host it as a website. My current requirement is to make this app run on a particular computer that has IIS installed on it but no Visual Studio.
My application makes use of MS-SQL database, Entity Framework, C# razors and all other .NET dependencies that are usual in a MVC app, and my target framework is 4.5.1 .
What I Found : I googled a lot, what I got is to create a Virtual Directory using the inetmgr and create the application under that directory. But since already the application is created I cannot go for this fix.
Please help me out by providing some links to refer to or steps to solve this.
Thanks in advance for any help.
What you will need to do is to either:
Use Visual Studio to publish the website directly onto the machine which is hosting the IIS application, as shown here.
Use Visual Studio an publish the application to a folder location on your machine and then use remote desktop or some other method to move the published DLL's to the virtual directory of the application.
Essentially both of them do the same thing, but sometimes due to security reasons, option 2 is easier to accomplish.
In advance, apologies for any improperly used terminology... I'm fairly new to web development/hosting, and IIS
I am trying to host a 64 bit ASP.Net 5 (MVC 6) web application, which uses beta 7, via IIS 7.5 on a windows Server 2008 R2 Standard machine.
I am publishing from Visual Studio 2015 (on a Windows 8 laptop) to a shared folder on the server. My IIS web application's physical path is the wwwroot folder created in the publish directory and the website seems to attempt to launch correctly...
Whenever the site attempts to run, however, I receive an error which states the following:
Unable to find the runtime directory 'D:\www\mysite\wwwroot\..\approot\runtimes\dnx-clr-win-x64.1.0.0-beta7'
Possible causes:
The runtime was not packaged with the application
The packaged runtime architecture is different from the application pool architecture.
The frustrating part is that if I copy and paste the link IIS claims it can't find and paste it into Windows Explorer, it leads me to a directory which does exist. That rules out the first explanation. As far as the second explanation goes, I have checked my publishing profile in Visual Studio and ensured that it is indeed the 64bit version of beta 7.
As far as I can tell, the proper runtime is sent with the published files, and they are the correct versions.
Is there anything I'm missing? The application runs fine in Visual Studio 2015. I don't know why when running on IIS it can't find a folder which not only exists, but is readily available to be browsed to.
UPDATE: I've continued to fight with this problem and found some odd symptoms... I can successfully make a website application from just about anywhere other than the D:\www folder. I stuck my site's published files container directly into the D drive and made a site directly from that, and it launched without a hitch. I was also able to replicate this on the C drive, and even placed the published files container into a folder called "wwww" in the D drive (so its physical path was D:\wwww\MySite\wwwroot as opposed to D:\www\MySite\wwwroot).
Does anybody know why "www" is problematic in particular? The folder structure in place here has several other (albeit much older) websites running from the www folder, so it's ideal that this application is placed in the same area. It seems like it works everywhere but there, however.
Any help is much appreciated!
For what it's worth, the solution I went with was to not place the application's publish folder in the D:\www folder. I ended up simply creating another folder in the root of the D drive and pointing the web application in IIS to that.
One of possible causes might be insufficient permissions for IIS user.
I added permission for approot (runtime) folder for IIS_IUSRS to read. Looks like IIS user was unable to read and load content of this directory because of insufficient permissions. After that it worked fine.
I have a perfectly running asp.net c# application, i have windows 7, vs200, vs2010 and sqlserver2008r2 installed on my computer. I use vs2008 for my application. I use web deploy in release mode to generate a package and send it to an administrator to deploy the pack on a testing server. the deployed application works fine for some aspx pages but for some others pages it doesn't find them and displays an error message:
server eror in '/' application
the resource cannot be found
description: http 404. the resource you are looking for could have been removed...
requested url: /pagename.aspx
thank's for the help
ps: i do not have access or control over the testing server. the application was working fine before my first deploy.
The best explanation is that pagename.aspx isn't at the expected location.
Check if the file is there
If so, check if iis has the right directory for you webapplication
If not, make a correct deployment (do a test deployment on an clean directory).
Another hypothesis: It can happen if you are using svn and forgot to add unversion files to subversion.
The exact error is as follows
Could not load file or assembly 'Microsoft.SqlServer.Replication,
Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
or one of its dependencies. An attempt was made to load a program with
an incorrect format.
I've recently started working on this project again after a two month move to another project. It worked perfectly before, and I've double checked all the references.
The answer by baldy below is correct, but you may also need to enable 32-bit applications in your AppPool.
Source: http://www.alexjamesbrown.com/uncategorized/could-not-load-file-or-assembly-chilkatdotnet2-or-one-of-its-dependencies-an-attempt-was-made-to-load-a-program-with-an-incorrect-format/
Whilst setting up an application to run on my local machine (running Vista 64bit) I encountered this error:
Could not load file or assembly ChilkatDotNet2 or one of its
dependencies. An attempt was made to load a program with an incorrect
format.
Obviously, the application uses ChilKat components, but it would seem that the version we are using, is only the 32bit version.
To resolve this error, I set my app pool in IIS to allow 32bit applications.
Open up IIS Manager, right click on the app pool, and select Advanced Settings (See below)
Then set "Enable 32-bit Applications" to True.
All done!
I've found the solution. I've recently upgraded my machine to Windows 2008 Server 64-bit. The SqlServer.Replication namespace was written for 32-bit platforms. All I needed to do to get it running again was to set the Target Platform in the Project Build Properties to X86.
Change the value for Platform Target on your web project's property page to Any CPU.
Go to IIS
-> Application Pool -> Advance Settings -> Enable 32-bit Applications
We recently had the issue when trying to run the code from Visual Studio. In that case you need to do
TOOLS > OPTIONS > Projects and Solutions > WEB PROJECTS and check the "Use the 64 bit version of IIS Express for web sites and projects".
For those who get this error in an ASP.NET MVC 3 project, within Visual Studio itself:
In an ASP.NET MVC 3 app I'm working on, I tried adding a reference to Microsoft.SqlServer.BatchParser to a project to resolve a problem where it was missing on a deployment server. (Our app uses SMO; the correct fix was to install SQL Server Native Client and a couple other things on the deployment server.)
Even after I removed the reference to BatchParser, I kept getting the "An attempt was made..." error, referencing the BatchParser DLL, on every ASP.NET MVC 3 page I opened, and that error was followed by dozens of page parsing errors.
If this happens to you, do a file search and see if the DLL is still in one of your project's \bin folders. Even if you do a rebuild, Visual Studio doesn't necessarily clear out everything in all your \bin folders. When I deleted the DLL from the bin and built again, the error went away.
I had this in an MVC5 app in Windows 10 against IIS Express. My solution was the following:
Tools =>
Options =>
Projects and Solutions =>
Web Projects =>
Use the 64 bit version of IIS Express for web sites and projects
change it to 32-bit (true) it works
if you get this Length cannot be less than zero. Parameter name: length issue in iis server configuation do the simple thing change the connection string in web.config file like your sql server name and server name and restart iis then try to load the page it works
If Publishing in Visual Studio 2012 when erroring try unchecking the "Procompile during publishing" option in the Publish wizard.
in windows form application I do this,
Right-click on Project->Properties->Build->Check Prefer 32-bit checkbox.
Thanks all
Delete the temp test directory located here
C:\Users(User)\AppData\Local\Temp\VisualStudioTestExplorerExtensions\
Set all projects to x64 in Visual Studio
Set the default processor architecture to x64(Test/TestSettings/Default Processor Architecture).
Make sure to clean build the solution file.Hope this helps!
Changing the Target Framework in project properties from .NET Framework 4.7.1 to 4.6.2 worked for me.