In my workstation I have used 32bit PC. There is no problem every this is working nice. But an unexpected situation arise recently when I try to deploy my application in to a 64 bit windows server. I never face this problem before.
Don't worry Technet library(Microsoft) is there. Just one line need to execute to solve my problem.
Actually I need to configure IIS to run 32-bit ASP.NET Applications on 64-bit Windows server.For this, we must configure IIS to create 32-bit worker processes. For more information about running 32-bit applications on 64-bit Windows.
IIS cannot run 32-bit and 64-bit applications concurrently on the same server.To enable IIS 6.0 to run 32-bit ASP.NET applications on 64-bit Windows.
Follow this steps:
1.Open a command prompt and navigate to the %systemdrive%\Inetpub\AdminScripts directory.
2.Type the following command:
cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 true
3.Press ENTER.
Now your 64 bit server is ready for run 32 bit application.
Some Important information
Before you configure IIS to run 32-bit applications on 64-bit Windows, note the following:
1.IIS only supports 32-bit worker processes in Worker Process Isolation mode on 64-bit Windows.
2.On 64-bit Windows, the World Wide Web Publishing service can run 32-bit and 64-bit worker processes. Other IIS services like the IIS Admin service, the SMTP service, the NNTP service, and the FTP service run 64-bit processes only.
3.On 64-bit Windows, the World Wide Web Publishing service does not support running 32-bit and 64-bit worker processes concurrently on the same server.
After configure problem may occurs
After you configure IIS 6.0 to run 32-bit Web applications, IIS stores 32-bit DLLs and ISAPIs in the %windir%\syswow64\inetsrv directory. All other IIS files, including the MetaBase.xml file, are stored in the %windir%\system32\inetsrv directory.
File access to the System32 and sub directories are transparently redirected based on the bitness of the process making that file access (64-bit processes have full access, while 32-bit processes have access to System32 redirected to Syswow64).
If your legacy applications have specific 32-bit file access needs and you notice application failures, see if the application needs to reference the new %windir%\syswow64\inetsrv to resolve the problem.
For more information visits here.
Sharing real-world experiences about C#, Dynamics CRM, Dynamics 365, Dynamics NAV/Business Central, SharePoint,PowerBI,ASP.net and more...
Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts
Tuesday, March 29, 2011
Monday, February 7, 2011
"System.Security.SecurityException: Security error" error message when the virtual directory points to a remote share in ASP.NET
Very recently, We have faced a problem to deploy application. The problem is raised when virtual directory points to a remote PC. The scenario is describe below..
PC1-- Web server(where IIS and .net framework is installed)
PC2-- Remote pc where precompile application directory located.
When deploy application virtual directory is created in PC1 but precompile application folder is points to remote PC2. After configure everything it shows me exception about security permission. After searching I added <trust level="Full"/ > in web.config file. Unfortunately, it shows me the same error
Parser Error Description:
After search in various site I found the solution in msdn.
Why this problem occur?
The System.Web namespace does not have the AllowPartiallyTrusted CallersAttribute applied to it.
http://msdn2.microsoft.com/en-us/library/ms994923.aspx
Any code that is not in the My_Computer_Zone code group that does not have this attribute requires the FullTrust user right. Therefore, the remote share that holds the Web applications content requires FullTrust.
Solution 1:Using Administrative Tools
To resolve this behavior, grant the FullTrust right to the remote share:
1. On the Web server, open Administrative Tools, and then double-click Microsoft .NET Framework Configuration.
2. Expand Runtime Security Policy, expand Machine, and then expand Code Groups.
3. Right-click All_Code, and then click New.
4. Select Create a new code group. Give your code group a relevant name, such as the name of the applications share. Click Next.
5. In the Choose the condition type for this code group list, select URL.
6. In the URL box, type the path of the share in the following format:
file:////\\computername\sharename\*
Note:Replace computername with the name of the computer that is hosting the remote share. Replace sharename with the name of the share.
7. Click Next. On the next page, select Use an existing permission set, and then select FullTrust.
8. Click Next, and then click Finish.
9. Restart Microsoft Internet Information Services (IIS) to restart the ASP.NET worker process.
If Microsoft .NET Framework Configuration is not displayed under Administrative Tools, you can install the .NET Framework SDK to add Microsoft .NET Framework Configuration.
Solution 2:Using Command line
Alternatively, you can run the following command to make the change:
Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\\computername\sharename\*" FullTrust -exclusive on
Note For more information about what these arguments do, run the following command:
caspol.exe -?
Additional Information:
In this configuration, the account under which the ASP.NET worker process runs must have sufficient rights to the remote share. You can set the account under which the worker process runs by using the Processmodel tag in the Machine.config file.
Back to the top
Steps to reproduce the behavior
1. Create a new virtual directory that points to a remote share.
2. Create an application for the virtual directory. Make sure that the user who connects to the share has read access to the remote content.
3. In the Processmodel tag of the Machine.config file, change the user to a domain user who has list, read, and execute permissions on the remote share.
4. Create an inline .aspx file, and then put the file in the remote share.
5. Make a request for the page.
For more information:
Please visits
http://support.microsoft.com/kb/317012
http://support.microsoft.com/kb/306590
PC1-- Web server(where IIS and .net framework is installed)
PC2-- Remote pc where precompile application directory located.
When deploy application virtual directory is created in PC1 but precompile application folder is points to remote PC2. After configure everything it shows me exception about security permission. After searching I added <trust level="Full"/ > in web.config file. Unfortunately, it shows me the same error
Parser Error Description:
An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
After search in various site I found the solution in msdn.
Why this problem occur?
The System.Web namespace does not have the AllowPartiallyTrusted CallersAttribute applied to it.
http://msdn2.microsoft.com/en-us/library/ms994923.aspx
Any code that is not in the My_Computer_Zone code group that does not have this attribute requires the FullTrust user right. Therefore, the remote share that holds the Web applications content requires FullTrust.
Solution 1:Using Administrative Tools
To resolve this behavior, grant the FullTrust right to the remote share:
1. On the Web server, open Administrative Tools, and then double-click Microsoft .NET Framework Configuration.
2. Expand Runtime Security Policy, expand Machine, and then expand Code Groups.
3. Right-click All_Code, and then click New.
4. Select Create a new code group. Give your code group a relevant name, such as the name of the applications share. Click Next.
5. In the Choose the condition type for this code group list, select URL.
6. In the URL box, type the path of the share in the following format:
file:////\\computername\sharename\*
Note:Replace computername with the name of the computer that is hosting the remote share. Replace sharename with the name of the share.
7. Click Next. On the next page, select Use an existing permission set, and then select FullTrust.
8. Click Next, and then click Finish.
9. Restart Microsoft Internet Information Services (IIS) to restart the ASP.NET worker process.
If Microsoft .NET Framework Configuration is not displayed under Administrative Tools, you can install the .NET Framework SDK to add Microsoft .NET Framework Configuration.
Solution 2:Using Command line
Alternatively, you can run the following command to make the change:
Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\\computername\sharename\*" FullTrust -exclusive on
Note For more information about what these arguments do, run the following command:
caspol.exe -?
Additional Information:
In this configuration, the account under which the ASP.NET worker process runs must have sufficient rights to the remote share. You can set the account under which the worker process runs by using the Processmodel tag in the Machine.config file.
Back to the top
Steps to reproduce the behavior
1. Create a new virtual directory that points to a remote share.
2. Create an application for the virtual directory. Make sure that the user who connects to the share has read access to the remote content.
3. In the Processmodel tag of the Machine.config file, change the user to a domain user who has list, read, and execute permissions on the remote share.
4. Create an inline .aspx file, and then put the file in the remote share.
5. Make a request for the page.
For more information:
Please visits
http://support.microsoft.com/kb/317012
http://support.microsoft.com/kb/306590
Wednesday, September 22, 2010
"It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level" in asp.net
Very recently, I have got this error message when try to browsing my developed application in asp.net. So I try to solve in many ways but failed then move to google...:). I got some nice solutions...now share with you:
This error occurs primarily out of 2 scenarios.
First scenario:
When you create an new web application using visual studio.net, it automatically creates the virtual directory and configures it as an application.
However, if you manually create the virtual directory and it is not configured as an application, then you will not be able to browse the application and may get the above error. The debug information you get as mentioned above, is applicable to this scenario.
This error occurs primarily out of 2 scenarios.
First scenario:
When you create an new web application using visual studio.net, it automatically creates the virtual directory and configures it as an application.
However, if you manually create the virtual directory and it is not configured as an application, then you will not be able to browse the application and may get the above error. The debug information you get as mentioned above, is applicable to this scenario.
Tuesday, April 20, 2010
Unable to start debugging on the web server. Could not start ASP.NET or ATL Server debugging.....
Yesterday I had started my work at new work station. Very recently I needed to test a web application on localhost. I found that IIS is not installed so that I installed it myself. Then I hosted it in localhost and try run but showed me an error. Today I want to share with you how to solve this problem.
Problem:
After developing an ASP.NET Web application by using localhost as the Web server, and config the Web site settings in Microsoft Internet Information Services (IIS) to use the localhost or specific IP address for Web Site Identification. Then, when I try to run the application, then receive the following error message:
Solution:
After search in google I have found lots of solution. But suddenly remembered that I have insatalled IIS after .net framework installed. I hope that this error occurs because Microsoft Internet Information Server (IIS) is not functioning properly. Then to resolve this issue IIS must be registered with .net framework. You can registered IIS with .net framework by executing this command from command prompt:
Now its fixed my problem.
Have a nice day!!
Problem:
After developing an ASP.NET Web application by using localhost as the Web server, and config the Web site settings in Microsoft Internet Information Services (IIS) to use the localhost or specific IP address for Web Site Identification. Then, when I try to run the application, then receive the following error message:
Error while trying to run project: Unable to start debugging on the web server. Could not start ASP.NET or ATL Server debugging.
Verify that ASP.NET or ATL Server is correctly installed on the server.
Solution:
After search in google I have found lots of solution. But suddenly remembered that I have insatalled IIS after .net framework installed. I hope that this error occurs because Microsoft Internet Information Server (IIS) is not functioning properly. Then to resolve this issue IIS must be registered with .net framework. You can registered IIS with .net framework by executing this command from command prompt:
>C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -i
Now its fixed my problem.
Have a nice day!!
Monday, April 19, 2010
Single Sign on (SSO) Using Cookie in asp.net
There are various ways to use Single Sign on(SSO) in asp.net web application. We can use cookies, session (state server), SAML and web services etc. Now we would like to give a brief overview of how to use cookie to implement Single Sign on(SSO) in asp.net web application.
Assume that we have two web application hosted on different virtual directory but under same domain. As for example, our root domain is: http://www.cookietest.com and
Other two virtual directory hosted under this domain are
http://www.cookietest.com/cookiesite1/Login.aspx
http://www.cookietest.com/cookiesite2/Default.aspx
If we login successfully in cookiesite1 then it writes the login information in cookie and now opens another tab or a new window in same browser (IE, FF whatever you like). Place this address http://www.cookietest.com/cookiesite2/Default.aspx in address bar logged in automatically in cookiesite2. When we try to access in cookiesite2 –> Default.aspx it checks the login information from cookie. If desired value found in cookie then you logged in automatically. Remember you need to enable cookie in your browser for all of these activities.
Configuration:
1. Web.Config
Before coding we need to some configure in our web.config file. Though cookiesite1 and cookiesite2 are in different virtual directory their web.config file must contains the same machine validationKey, decryptionKey and validation.
Like this,
<machineKey validationKey="282487E295028E59B8F411ACB689CCD6F39DDD21E6055A3EE480424315994760ADF21B580D8587DB675FA02F79167413044E25309CCCDB647174D5B3D0DD9141"
decryptionKey="8B6697227CBCA902B1A0925D40FAA00B353F2DF4359D2099"
validation="SHA1" />
2. IIS
In IIS->Directory security tab add the "ASPNET Machine Account" user and set the full rights.
Coding:
Write cookie after login complete:
Place this code in cookiesite1->Login.aspx.cs
Place this code in cookiesite2->Default.aspx.cs
Read cookie when page load:
Add this method in cookiesite2->Default.aspx.cs
Test the application in localhost.And for more information:
http://msdn.microsoft.com/en-us/library/aa289495%28VS.71%29.aspx#vbtchaspnetcookies101anchor10
http://www.aspnettutorials.com/tutorials/network/cookies-csharp.aspx
http://www.developer-corner.com/Resources/KnowledgeBase/tabid/118/articleType/ArticleView/articleId/23/PageID/10/Single-Sign-On-across-multiple-ASPNET-applications.aspx
Assume that we have two web application hosted on different virtual directory but under same domain. As for example, our root domain is: http://www.cookietest.com and
Other two virtual directory hosted under this domain are
http://www.cookietest.com/cookiesite1/Login.aspx
http://www.cookietest.com/cookiesite2/Default.aspx
If we login successfully in cookiesite1 then it writes the login information in cookie and now opens another tab or a new window in same browser (IE, FF whatever you like). Place this address http://www.cookietest.com/cookiesite2/Default.aspx in address bar logged in automatically in cookiesite2. When we try to access in cookiesite2 –> Default.aspx it checks the login information from cookie. If desired value found in cookie then you logged in automatically. Remember you need to enable cookie in your browser for all of these activities.
Configuration:
1. Web.Config
Before coding we need to some configure in our web.config file. Though cookiesite1 and cookiesite2 are in different virtual directory their web.config file must contains the same machine validationKey, decryptionKey and validation.
Like this,
<machineKey validationKey="282487E295028E59B8F411ACB689CCD6F39DDD21E6055A3EE480424315994760ADF21B580D8587DB675FA02F79167413044E25309CCCDB647174D5B3D0DD9141"
decryptionKey="8B6697227CBCA902B1A0925D40FAA00B353F2DF4359D2099"
validation="SHA1" />
2. IIS
In IIS->Directory security tab add the "ASPNET Machine Account" user and set the full rights.
Coding:
Write cookie after login complete:
Place this code in cookiesite1->Login.aspx.cs
If(login_Successful)Check cookie is exist or not on page_load
{
//Create a new cookie, passing the name into the constructor
HttpCookie cookie = new HttpCookie(“strCookieName”);
//Set the cookies value
cookie.Value =”set_cookie_value”;
//Set the cookie to expire in 5 minute
DateTime dtNow = DateTime.Now;
TimeSpan tsMinute = new TimeSpan(0, 0, 5, 0);
cookie.Expires = dtNow + tsMinute;
//Add the cookie
Response.Cookies.Add(cookie);
Response.Write("Cookie written. ");
}
Place this code in cookiesite2->Default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
//Grab the cookie
HttpCookie cookie = Request.Cookies[“strCookieName”];
//Check to make sure the cookie exists
if (cookie != null)
{
ReadCookie();
}
Else
{
lblCookie.Text = "Cookie not found. ";
}
}
Read cookie when page load:
Add this method in cookiesite2->Default.aspx.cs
protected void ReadCookie()
{
//Get the cookie name the user entered
//Grab the cookie
HttpCookie cookie = Request.Cookies[“strCookieName”];
//Check to make sure the cookie exists
if (cookie == null)
{
lblCookie.Text = "Cookie not found. ";
}
else
{
//Write the cookie value
String strCookieValue = cookie.Value.ToString();
lblCookie.Text = "The cookie contains: " + strCookieValue + "";
}
}
Test the application in localhost.And for more information:
http://msdn.microsoft.com/en-us/library/aa289495%28VS.71%29.aspx#vbtchaspnetcookies101anchor10
http://www.aspnettutorials.com/tutorials/network/cookies-csharp.aspx
http://www.developer-corner.com/Resources/KnowledgeBase/tabid/118/articleType/ArticleView/articleId/23/PageID/10/Single-Sign-On-across-multiple-ASPNET-applications.aspx
Monday, February 15, 2010
How to speed up your web site/application
In my recent experience I have faced some performance issues one of them is web application becomes very much slow. To identify this problem I have searched over the net and I have found a lots of topics.
Now I want to share some of the topics with you in summarized way:
1.Minimize HTTP Requests
2.Use a Content Delivery Network
3.Add an Expires or a Cache-Control Header
4.Gzip Components
5.Put Stylesheets at the Top
6.Put Scripts at the Bottom
7.Avoid CSS Expressions
8.Make JavaScript and CSS External
9.Reduce DNS Lookups
10.Minify JavaScript and CSS
11.Avoid Redirects
12.Remove Duplicate Scripts
13.Configure ETags
14.Make Ajax Cacheable
15.Flush the Buffer Early
16.Use GET for AJAX Requests
17.Post-load Components
18.Preload Components
19.Reduce the Number of DOM Elements
20.Split Components Across Domains
21.Minimize the Number of iframes
22.No 404s
23.Reduce Cookie Size
24.Use Cookie-free Domains for Components
25.Minimize DOM Access
26.Develop Smart Event Handlers
27.Choose over @import
28.Avoid Filters
29.Optimize Images
30.Optimize CSS Sprites
31.Don't Scale Images in HTML
32.Make favicon.ico Small and Cacheable
33.Keep Components under 25K
34.Pack Components into a Multipart Document
35.Enable HTTP Keep-Alives
36.Adjust Connection Timeouts
37.Enable HTTP Compression
Now I want to share some of the topics with you in summarized way:
1.Minimize HTTP Requests
2.Use a Content Delivery Network
3.Add an Expires or a Cache-Control Header
4.Gzip Components
5.Put Stylesheets at the Top
6.Put Scripts at the Bottom
7.Avoid CSS Expressions
8.Make JavaScript and CSS External
9.Reduce DNS Lookups
10.Minify JavaScript and CSS
11.Avoid Redirects
12.Remove Duplicate Scripts
13.Configure ETags
14.Make Ajax Cacheable
15.Flush the Buffer Early
16.Use GET for AJAX Requests
17.Post-load Components
18.Preload Components
19.Reduce the Number of DOM Elements
20.Split Components Across Domains
21.Minimize the Number of iframes
22.No 404s
23.Reduce Cookie Size
24.Use Cookie-free Domains for Components
25.Minimize DOM Access
26.Develop Smart Event Handlers
27.Choose over @import
28.Avoid Filters
29.Optimize Images
30.Optimize CSS Sprites
31.Don't Scale Images in HTML
32.Make favicon.ico Small and Cacheable
33.Keep Components under 25K
34.Pack Components into a Multipart Document
35.Enable HTTP Keep-Alives
36.Adjust Connection Timeouts
37.Enable HTTP Compression
Monday, January 18, 2010
Problem with Session StateServer mode
StateServer mode stores session state in a process, referred to as the ASP.NET state service, that is separate from the ASP.NET worker process or IIS application pool. Using this mode ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
But new user are facing problem with this Session state mode.
First ensure to use StateServer mode, you must first be sure the ASP.NET state service is running on the server used for the session store. The ASP.NET state service is installed as a service when ASP.NET and the .NET Framework are installed.
The ASP.Net state service is installed at the following location:
systemroot\Microsoft.NET\Framework\versionNumber\aspnet_state.exe
To configure an ASP.NET application to use StateServer mode, in the application's Web.config file do the following:
1.Set the mode attribute of the sessionState element to StateServer.
2.Set the stateConnectionString attribute to tcpip=serverName:42424.
Example:
<configuration>
<system.web>
<sessionState mode="StateServer"
stateConnectionString="tcpip=SampleStateServer:42424"
cookieless="false"
timeout="20"/>
</system.web>
</configuration>
Problem:
"Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same. If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection. If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.
Solution:
Main solution is allow remote connection from registry.
To allow remote connection:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection set value to 1
Restart ASP.NetStateService from systemroot\Microsoft.NET\Framework\versionNumber\aspnet_state.exe.
For more information visit: http://msdn.microsoft.com/en-us/library/ms178586.aspx
But new user are facing problem with this Session state mode.
First ensure to use StateServer mode, you must first be sure the ASP.NET state service is running on the server used for the session store. The ASP.NET state service is installed as a service when ASP.NET and the .NET Framework are installed.
The ASP.Net state service is installed at the following location:
systemroot\Microsoft.NET\Framework\versionNumber\aspnet_state.exe
To configure an ASP.NET application to use StateServer mode, in the application's Web.config file do the following:
1.Set the mode attribute of the sessionState element to StateServer.
2.Set the stateConnectionString attribute to tcpip=serverName:42424.
Example:
<configuration>
<system.web>
<sessionState mode="StateServer"
stateConnectionString="tcpip=SampleStateServer:42424"
cookieless="false"
timeout="20"/>
</system.web>
</configuration>
Problem:
"Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same. If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection. If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.
Solution:
Main solution is allow remote connection from registry.
To allow remote connection:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection set value to 1
Restart ASP.NetStateService from systemroot\Microsoft.NET\Framework\versionNumber\aspnet_state.exe.
For more information visit: http://msdn.microsoft.com/en-us/library/ms178586.aspx
Subscribe to:
Posts (Atom)
Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'
Exception: Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'...
-
It is very common questions for new web developer how to get the client's country location to track the user.In various forum I have f...
-
Today I have added Google Map my asp.net application successfully !! Don't worry it's not a big deal. Very easy and you will find a ...
-
There are various ways to use Single Sign on(SSO) in asp.net web application. We can use cookies, session (state server), SAML and web serv...
