iis 6.2 using aspnet_compiler.exe to Precompile - iis-6

I am using IIS 6.2 and able to pre-complie in place an application successfully using C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe using the parameters -p "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files" -v "/VirtualApplication"
it create the cache fold as expected, the issue is when I access the site from a browser iis does not use the existing cache folder it is making a new folder.
How do I Instruct IIS to use the precompiled version. on IIS 6.2 what is the best practice for Precompiling in place.

Precompile ASP.NET Website
The -p parameter is the path to your actual website which will be something like C:\InetPub\MySite
The -v parameter is the path the web browser will use which will be just a forward-slash if it is the root. IE:/ If your site is to be reached at stackoverflow.com then your virtualPath would be / but if your site was at stackoverflow.com/MySite then your virtualPath would be /mySite
aspnet_compiler will create compiled copies of your website's .NET libraries and save them somewhere on the system that you don't need to worry about because IIS will automatically use them instead of compiling new ones.

Related

Hosting blazor wasm asp.net core hosted app in kestrel

I am having troubles hosting the blazor wasm asp.net core hosted application.. The solution has 3 projects: Client, Shared, and Server.
when I run the command dotnet publish --configuration Release it publishes the libraries to their respective folders in solution like this:
WebWorkbench3\Client\bin\Release\net5.0\publish
WebWorkbench3\Server\bin\Release\net5.0\publish
...
I would assume that since the server project is referencing a client - then my steps to host the application are following:
Open WebWorkbench3\Server\bin\Release\net5.0\publish in powershell
Run command dotnet .\WebWorkbench3.Server.dll
Navigate to: https://localhost:5001/
Result:
Expected: client page opened
Actual: page is stuck at "Loading.." string. In the console we see that there was an error about _framework/blazor.webassembly.js not being loaded.
If we were to check the wwwroot folder contents in the server app we will see the following:
So this explains why the error is shown. However my question at this point - should the publishing process/configuration in project take care of copying client's wwwroot contents into the the server's app output directory? If we start a debugging session in the VisualStudio, then we use the server as the startup point, so the project should have some idea where to look up the blazor.webassembly.js file at..
So why doesn't the same process occurs during the publishing?
Note: I was able to fix the issue by manually copying the client's wwwroot directory and by placing the contents into the server's wwwroot directory... But I don't think that is is how serving is supposed to work?
EDIT: I have just tried to set-up the client blazor application in IIS. And it works. Kind of. The page is opened. But then when it tries to make a REST GET request to the server - it uses the same hostname:port combination. So if my app is hosted on mysite.local:50001 then the request to API will look like mysite.local:50001/data/loadall where data is the controller name and loadall is the action name.. So basically the client uses the same base address as the server.. The problem, is that I cannot start the server on the same port as the client! In attempt in doing so - you will see following output:
So basically I have the same question as before - how to host the wasm application that is split between client and the server? I am pretty sure that I can make it work by forcing the client to use the non-standard server port and serving the server part on that port.. However, I believe there should be a reason why current configuration (default configuration in the blazor wasm template) is configured in this way so it should be possible to run the project somehow without any additional changes at all..
Well this will be a self-answer.. Instead of publishing (dotnet publish --configuration Release) the application on solution level - do the publishing on project level..
before ..\repos\WebWorkbench3\WebWorkbench3
after ..\repos\WebWorkbench3\WebWorkbench3\Server
In 1 case the compiler does not copy the _framework folder (and possibly some other files) into the wwwroot.. Once you have published the Server correctly you can access the app by serving it with dotnet .\WebWorkbench3.Server.dll command.
Having the samie issue as explained above:
Before:
The solution file
had the same name
was in the same folder
as the server project
Resolved
I moved the solution to the project root (one level up).
Now, dotnet publish within the server project produced the __framework folder + content as expected.

IIS is not allowing to access a javascript file

i have a web application. while running in my system integration environment, i get an issue while accessing my javascript file or an image file in my particular folder.
When i tried putting the complete URL in the browser, it gave me a following exception -
HTTP Error 404.2 Not Found
The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the webserver.
I googled this exception and found that i need to allow ASP.NET 4.0, 2.0, etc in the IIS's ISAPI & CGi Restrictions.. however, they were already in allow mode.
What next should i lookup?
OK,, i got the answer
the HTTP Handler in the applicatin's web.config file was trying to execute via a aspnet_isapi.dll located in Framework64 folder of .NET Framework.. the target machine however is a 32 bit and i dont have this Framework64 folder on it..
i changed the path of the executable to point to the 32 bit's folder and it wrked :)

Default route in MVC working from VS, but not on test server

I have a very simple ASP.NET MVC 4.0 website. It's got a single controller ("HomeController") with a single action ("Index") which receives a single parameter ("string id"). I have not modified the global.asax file since this kind of route is handled by default. I have not created a view for this action since the action will simply be "sending" the user a file (a PDF). If I run the site from within Visual Studio (using a default page of "home/index/3" in project properties), the page runs fine. If, however, I publish the site to our test server (https://ourserver.com/mysite/home/index/3), I get a 404--File or Directory not found.
NOTE: We're running IIS7.5 on this server.
UPDATE: The bin dir (and the appropriate DLL, i.e., one named after the project) and the web.config file are there.
So, why is this not working?
If you're using an older version of IIS and haven't installed the MVC server extensions which give you routing, you can do a BIN deployment of the necessary infrastructure files.
Edit: If you're running IIS 7.5 you should have everything you need. You mention you don't see a web.config file or any dlls - how did you publish? You should absolutely have a web.config at the root of the publish directory and a bin folder with your dll(s).
If you right-click on your web project and do Publish, you can publish to a local directory. It'll be exactly what you should see when deployed.
Edit 2: Did you check that it's configured in IIS as a web application and not just a site?

How to register WCF on a website other than Default Web Site with ServiceModelReg?

I am trying to fix a problem where my wCF services will not work on my live site which runs under it's own website instead of under Default Web Site.
I am trying to run ServiceModelReg -i but for my website, not the Default. If I put -h it says that "-s:" will recursively install the components for the particular path. However, when I run "ServiceModelReg -s:W3SVC/1/root" then it says "Error: No valid options were specified..." -s does the same thing, in short it does not seem to work.
I read here that I could run it for my website instead of Defafult Web Site by incrementing the number, but it does not seem to work even with just the s.
So the question is: How can I run this option with -s for my website (it is called pokerdiy.com in IIS and is a sibling of the Default Web Site).
The website is running on IIS 7.5.7600.16385 on Windows Server 2008 R2 Version 6.1 SP1 (64 bit) in an Integrated Application pool with .NET 4.0.
servicemodelreg.exe installs at machine level not at site level. If a .svc file is not served by the non-default site, the problem lies with the settings that should have been setup through running aspnet_regiis -i -s <your site path>

How can I get aspnet compiler to handle a page that contains an include file

I have a web application that lands on a shared hosting platform for my company. That platform has global header/footer code that all applications on the platform consume using include files. I can't change how the header files are structured and how they are to be cosumed--that is dictated to me by another group. I have a build server that does not has IIS installed by design. I am attempting to use the aspnet_compiler.exe during the build process to generate the precompiled website files for deployment.
However, when the build runs I get errors like this:
/Company/Controls/Header.ascx(7): error ASPPARSE: Failed to map the path '/sites/header.inc'.
The Header.ascx control has this server-side include in the HTML:
<!-- #include virtual="/sites/header.inc" -->
On my local machine, I have created a virtual directory in IIS named "sites" that points to the global header code (which I have also copied to my local machine). This same "sites" virtual exists in IIS on the hosting environment. I would really like to avoid having to install IIS on the build machine because it is a shared build machine and I don't anyone to mistakenly work IIS dependencies into their code. The build machine shouldn't need to have IIS.
What is the best way to get the precompiled site files that aspnet_compiler.exe produces during my build without installing IIS?
Microsoft has a very simple example of how to replace an include statement...
http://support.microsoft.com/kb/306575
Looking at the path of your error it seems you are already using some sort of global user control and I'm guessing this is a file which is reused by other applications or languages so I would suggest coming up with a more custom version with error handling and such since it is working over a mapped drive but the basic answer is you need to read the file and output it to the stream during the Render event.
Don't use server-side includes. They are ancient technology and are disabled on most modern sites.
I recommend you instead create .ascx files to replace each of the .inc files, and use those instead.
Try this:
<!-- #include virtual="~/sites/header.inc" -->
The ~ is a shortcut for "root of the web application."